<!DOCTYPE html> <html> <head> <title>表格</title> <meta charset="utf-8" /> <style type="text/css"> *{ font-size: 36px; } tr{ height: 30px; } </style> </head> <body> <table width="1000px" border="1"> <tr height="30px"> <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td> </tr> </table> <input type="button" name="" id="add" value="添加一行" style="margin-left:840px;" onclick="add()" onmouseover="light()"/> <input type="button" name="" id="delete" value="删除一行" style="margin-left:840px;" onclick="del()"/> <script type="text/javascript"> function add(){ var tab=document.getElementsByTagName('table')[0]; var two=document.createElement("tr"); var v1=document.createElement('td'); var v2=document.createElement('td'); var v3=document.createElement('td'); var v4=document.createElement('td'); var v5=document.createElement('td'); var v6=document.createElement('td'); var v7=document.createElement('td'); var v8=document.createElement('td'); var v9=document.createElement('td'); var v10=document.createElement('td'); var v11=document.createElement('td'); var v12=document.createElement('td'); two.appendChild(v1); two.appendChild(v2); two.appendChild(v3); two.appendChild(v4); two.appendChild(v5); two.appendChild(v6); two.appendChild(v7); two.appendChild(v8); two.appendChild(v9); two.appendChild(v10); two.appendChild(v11); two.appendChild(v12); tab.appendChild(two); } function del(){ var tab=document.getElementsByTagName('table')[0]; var trs=document.getElementsByTagName('tr')[1]; tab.removeChild(trs); } function light(){ var trs1=document.getElementsByTagName('tr'); for(var i=0;i<trs1.length;i++){ trs1[i].onmouseover=function(){ this.style.borderColor="red"; } trs1[i].onmouseout=function(){ this.style.borderColor="#000"; } } } </script> </body> <ml>
任务1-10-1 js程序题
10
分
任务尚未发布或者你没有权限查看任务内容。
任务讨论