<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title> Add table Row </title>
<script language= "javascript" >//example:obj = Findobj ("Image1");
function Findobj (theobj, thedoc) {
var p, I, foundobj;
if (!thedoc) thedoc = document;
if (p = theobj.indexof ("?")) > 0 && parent.frames.length) {
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;
}
Add a participant to fill in the line
function Addsignrow () {//reads the line number of the last line and holds it in the Txttrlastindex text box
var txttrlastindex = findobj ("Txttrlastindex", document);
var RowID = parseint (Txttrlastindex.value);
var signframe = findobj ("Signframe", document);
Adding rows
var newtr = Signframe.insertrow (signFrame.rows.length);
Newtr.id = "Signitem" + RowID;
Add Column: Ordinal
var Newnametd=newtr.insertcell (0);
Add Column Contents
newnametd.innerhtml = NewTR.rowIndex.toString ();
Add Column: Name
var Newnametd=newtr.insertcell (1);
Add Column Contents
newnametd.innerhtml = "<input name= ' txtname" + RowID + "' id= ' txtname" + RowID + "' type= ' text ' size= '/> '";
Add Column: E-mail
var Newemailtd=newtr.insertcell (2);
Add Column Contents
newemailtd.innerhtml = "<input name= ' Txtemail" + RowID + "' id= ' txtemail" + RowID + "' type= ' text ' size= '"/> ";
Add Column: Delete button
var Newdeletetd=newtr.insertcell (3);
Add Column Contents
newdeletetd.innerhtml = "<div align= ' center ' style= ' width:40px ' ><a href= ' javascript:; ' onclick=\ ' Deletesignrow (' Signitem ' + RowID + "') \" > Delete </a></div> ";
Advance line number to next line
Txttrlastindex.value = (RowID + 1). ToString ();
}
Delete the specified line
function Deletesignrow (ROWID) {
var signframe = findobj ("Signframe", document);
var Signitem = findobj (rowid,document);
Gets the index of the row that will be deleted
var rowIndex = Signitem.rowindex;
Delete the row for the specified index
Signframe.deleterow (RowIndex);
Rearrange the ordinal, if there is no ordinal, this step is omitted
for (i=rowindex;i<signframe.rows.length;i++) {
signframe.rows[i].cells[0].innerhtml = i.ToString ();
}
}//emptying the list
function Clearallsign () {
if (Confirm (' OK to clear all participants? ‘)){
var signframe = findobj ("Signframe", document);
var rowscount = signFrame.rows.length;
Loop delete rows, remove them from the last line
for (i=rowscount-1;i > 0; i--) {
Signframe.deleterow (i);
}
Reset the last line number to 1
var txttrlastindex = findobj ("Txttrlastindex", document);
Txttrlastindex.value = "1";
Pre-Add a row
Addsignrow ();
}
}
</script>
<body>
<div>
<table width= "613" border= "0" cellpadding= "2" cellspacing= "1" id= "Signframe" >
<tr id= "Trheader" >
<TD width= "bgcolor=" #96E0E2 "> Serial number </td>
<TD width= "Up" bgcolor= "#96E0E2" > User name </td>
<TD width= "98" bgcolor= "#96E0E2" > E-mail </td>
<TD width= "align=" "Center" bgcolor= "#96E0E2" > </td>
</tr>
</table>
</div>
<div>
<input type= "button" Name= "Submit" value= "Add participant" onclick= "Addsignrow ()"/>
<input type= "button" Name= "Submit2" value= "Empty" onclick= "clearallsign ()"/>
<input name= ' txttrlastindex ' type= ' hidden ' id= ' txttrlastindex ' value= ' 1 '/>
</div>
</body>
JS Delete node