Copy code code as follows:
<! Doctype html>
<html>
<head>
<Title> Table1.html </Title>
<meta http-equiv = "keywords" content = "keyword1, keyword2, keyword3">
<meta http-equiv = "description" content = "this is my page">>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<!-<link REL = "STYLESHEET" Type = "Text/CSS" HREF = "./ Styles.css">->
<script language = "javascript" type = "text/javascript">
<!--
Function test1 () {
// Determine whether the inserted number exists
for (var I = 0; I <mytable.rows.length; i ++) {
var eachrow = mytable.rows [i];
if (eachRow.cells [0] .innertext == no.value) {
Window.alert ("Numbers already exist!");
Return;
}
}
// Get the data in the form
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;
}
Function test2 () {) {
mytable.deleterow (mytable.rows.length-);
}
//->
</script>
</head>
<body>
<H1> Heroes Ranking </h1>
<table id = "mytable" border = "1">
<TR> <TD> Ranking </td> <TD> Name </td> <TD> Nickname </td> </tr>
<TR> <TD> 1 </td> <TD> Song Jiang </td> <TD> Timely rain </td> </tr>
<TR> <TD> 2 </td> <TD> Lu Junyi </td> <TD> Yu Qilin </td> </tr>
</table>
<h1> Please enter the new good man </h1>
Number <input id = "no" type = "text" value = ""> <br/> <br/>
Name <input ID = "name1" type = "text" value = ""> <br/>
Nickname <input ID = "nickname" type = "text" value = ""> <br/>
<input ID = "tianjia" type = "Button" value = "Add" OnClick = "Test1 ()">
<input type = "Button" value = "Delete the last line of" OnClick = "Test2 ()"/>/>
</body>
</html>