複製程式碼 程式碼如下: New Document // Example: obj = findObj("image1");<br>function findObj(theObj, theDoc)<br>{ <br>var p, i, foundObj; <br>if(!theDoc) theDoc = document; <br>if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) <br>{ theDoc = parent.frames[theObj.substring(p+1)].document; theObj = theObj.substring(0,p); } if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj]; for (i=0; !foundObj && i < theDoc.forms.length; i++) foundObj = theDoc.forms[i][theObj]; for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) foundObj = findObj(theObj,theDoc.layers[i].document); if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj); return foundObj;<BR>}<BR>//添加一个参与人填写行<BR>function AddSignRow(){ //读取最后一行的行号,存放在txtTRLastIndex文本框中 <BR>var txtTRLastIndex = findObj("txtTRLastIndex",document);<BR>var rowID = parseInt(txtTRLastIndex.value);<BR>var signFrame = findObj("SignFrame",document);<BR>//添加行<BR>var newTR = signFrame.insertRow(signFrame.rows.length);<BR>newTR.id = "SignItem" + rowID;<BR>//添加列:序号<BR>var newNameTD=newTR.insertCell(0);<BR>//添加列内容<BR>newNameTD.innerHTML = newTR.rowIndex.toString();<BR>//添加列:姓名<BR>var newNameTD=newTR.insertCell(1);<BR>//添加列内容<BR>newNameTD.innerHTML = "<input name='txtName" + rowID + "' id='txtName" + rowID + "' type='text' size='12' />";<br>//添加列:电子邮箱<br>var newEmailTD=newTR.insertCell(2);<br>//添加列内容<br>newEmailTD.innerHTML = "<input name='txtEMail" + rowID + "' id='txtEmail" + rowID + "' type='text' size='20' />";<br>//添加列:电话<br>var newTelTD=newTR.insertCell(3);<br>//添加列内容<br>newTelTD.innerHTML = "<input name='txtTel" + rowID + "' id='txtTel" + rowID + "' type='text' size='10' />";<br>//添加列:手机<br>var newMobileTD=newTR.insertCell(4);<br>//添加列内容<br>newMobileTD.innerHTML = "<input name='txtMobile" + rowID + "' id='txtMobile" + rowID + "' type='text' size='12' />";<br><br>//添加列:公司名<br>var newCompanyTD=newTR.insertCell(5);<br>//添加列内容<br>newCompanyTD.innerHTML = "<input name='txtCompany" + rowID + "' id='txtCompany" + rowID + "' type='text' size='20' />"; <p>//添加列:删除按钮<br>var newDeleteTD=newTR.insertCell(6);<br>//添加列内容<br>newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='#'" + rowID + "')">删除</a></div>";<br>//将行号推进下一行<br>txtTRLastIndex.value = (rowID + 1).toString() ;<br>}<br>//删除指定行<br>function DeleteSignRow(rowid){<br>var signFrame = findObj("SignFrame",document);<br>var signItem = findObj(rowid,document);<br>//获取将要删除的行的Index<br>var rowIndex = signItem.rowIndex;<br>//删除指定Index的行<br>signFrame.deleteRow(rowIndex);<br>//重新排列序号,如果没有序号,这一步省略<br>for(i=rowIndex;i<signFrame.rows.length;i++){<BR>signFrame.rows[i].cells[0].innerHTML = i.toString();<BR>}<BR>}//清空列表<BR>function ClearAllSign(){<BR>if(confirm('确定要清空所有参与人吗?')){<BR>var signFrame = findObj("SignFrame",document);<BR>var rowscount = signFrame.rows.length;<BR>//循环删除行,从最后一行往前删除<BR>for(i=rowscount - 1;i > 0; i--){<br>signFrame.deleteRow(i);<br>}<br>//重置最后行号为1<br>var txtTRLastIndex = findObj("txtTRLastIndex",document);<br>txtTRLastIndex.value = "1";<br>//预添加一行<br>AddSignRow();<br>}<br>}<br>序号用户姓名电子邮箱固定电话移动手机公司名称 ;