次のようにコードコードをコピーします。
<!doctype html>
<html>
<head>
<title> table1.html </title>
<meta http-equiv = "keywords" content = "keyword2、keyword3">
<メタhttp-equiv = "description" content = "これは私のページ" >>
<メタhttp-equiv = "content-type" content = "text/html; charset = utf-8">
<! - <link rel = "styleSheet" type = "text/ css" href = "./ styles.css"> - >
<スクリプト言語= "javascript" type = "text/javascript">
<! -
関数test1(){
//挿入された番号が存在するかどうかを判断します
for(var i = 0; i <mytable.rows.length; i ++){
var hirlrow = mytable.rows [i];
if(thresrow.cells [0] .innertext == no.value){
window.alert( "数字既に存在します!");
戻る;
}
}
//フォームでデータを取得します
var newtablerow = mytable.insertrow(mytable.rows.length);
newtablerow.insertcell(0).innertext = no.value;
newtablerow.insertcell(1).innertext = name1.value;
newtablerow.insertcell(2).innertext = nickname.value;
}
関数test2(){){
mytable.deleterow(mytable.rows.length-);
}
//->
</script>
</head>
<body>
<h1>ヒーローランキング</h1>
<表ID = "myTable" border = "1">
<tr> <td>ランキング</td> <td> name </td> <td> nickname </td> </tr>
<tr> <td> 1 </td> <td> song jiang </td> <td>タイムリーな雨</td> </tr>
<tr> <td> 2 </td> <td> lu junyi </td> <td> yu qilin </td> </tr>
</table>
<h1>新しい善良な男を入力してください</h1>
番号<入力ID = "no" type = "text" value = ""> <br/> <br/>
name <input id = "name1" type = "text" value = ""> <br/>
ニックネーム<入力ID = "nickname" type = "text" value = ""> <br/>
<入力id = "tianjia" type = "button" value = "add" onclick = "test1()">
<入力型= "button" value = "onclick =" test2() "/>/>の最後の行を削除します
</body>
</html>