<div class="codetitle"> <span><a style="CURSOR: pointer" data="49688" class="copybut" id="copybut49688" onclick="doCopy('code49688')"><u>코드 복사</u></a></span> 코드는 다음과 같습니다.</div> <div class="codebody" id="code49688"> <br><!DOCTYPE html> ; <br><head> <br><title>table1.html</title> <br><br><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> 🎜>< ;meta http-equiv="description" content="이것은 내 페이지입니다"> <br><meta http-equiv="content-type" content="text/html; charset=UTF-8" > <br><br><!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <br><스크립트 언어 = "javascript " type = "text/javascript"> <br><!-- <BR>function test1(){ <BR>//삽입된 숫자가 이미 존재하는지 판단<BR>for(var i=0 ;i< mytable.rows.length;i ){ <BR>var EachRow = mytable.rows[i] <BR>if(eachRow.cells[0].innerText == no.value){ <BR>window. Alert(" 번호가 이미 존재합니다! "); <BR>return ; <BR>} <BR>} <BR>//양식으로 데이터 가져오기<BR>var newTableRow(mytable.rows.length) ); <BR> newTableRow.insertCell(0).innerText = no.value; <BR>newTableRow.insertCell(1).innerText = name1.value; <BR>newTableRow.insertCell(2).innerText = nickName.value; <BR>} <BR><BR>function test2(){ <br>mytable.deleteRow(mytable.rows.length-1) <br>} <BR>//--> script> <br> </head> <br><br><body> <br><h1>영웅 순위</h1><table id="mytable" border="1"><tr><td>순위</td>이름</td><td>닉네임</td></tr> ;1</td><td>쑹장</td><td>적절한 비</td></tr> <br><tr><td>2</td>< ;루준이</td><td>유치린</td></tr> <br></table> <br><h1>새 영웅을 입력하세요</h1> ;입력 ID = "no" 유형 = "text" 값 = ""><br/> <br>이름<input id = "name1" 유형 = "text" 값 = ""><br/ > <br>닉네임<input id = "nickName" type = "text" value = ""><br/> <br><input id = "tianjia" type = "button" value = "추가 " onclick = "test1()"> <br><input type = "button" value = "마지막 줄 삭제" onclick = "test2()"/> <br>< /body> <br>< ;/html> <br><br> <br><br> </table> </div>