|
发表于 2005-10-11 09:38:35
|
显示全部楼层
试试看
- </html>
- <table width="400" id="tab1" border="0" CELLPADDING ="0" cellspacing ="0" >
- <tr bgcolor="#FFFFFF" name="inserttr">
- <td><input type="checkbox" disabled="true"/></td>
- <td><input type="text" name="text1"></td>
- <td><input type="text" name="text2"></td>
- <td><input type="text" name="text3"></td>
- </tr>
- </table>
- <input type="button" name="addrow" value="增加" onclick="insertTR()">
- <input type="button" name="delrow" value="删除" onclick="deleteTR()">
- </html>
- <script language="javascript" id="insertable">
- function insertTR() {
- var oRow1=tab1.insertRow(tab1.rows.length);
- var cellone=oRow1.insertCell(0);
- var cellone1=oRow1.insertCell(1);
- var cellone2=oRow1.insertCell(2);
- var cellone3=oRow1.insertCell(3);
- var contnttext=document.createElement("<input type=checkbox>");
- var contnttext1=document.createElement("<input type=text name=text1>");
- var contnttext2=document.createElement("<input type=text name=text2>");
- var contnttext3=document.createElement("<input type=text name=text3>");
-
- cellone.appendChild(contnttext);
- cellone1.appendChild(contnttext1);
- cellone2.appendChild(contnttext2);
- cellone3.appendChild(contnttext3);
- }
- function deleteTR() {
- j=1;
- while(j<tab1.rows.length) {
- var oChild=tab1.rows(j);
- if(oChild.cells(0).children(0).checked==true) {
- i=0;
- oChild.disabled=true;
- oChild.style.display="none";
- }
- j++;
- }
- }
- </script>
复制代码 |
|