Example 1(For details, refer to flow_card_add.jsp in DRP)
<SCRIPT>
VaR rowindex = 0;
Function addonelineonclick (){
VaR ROW = tblflowcarddetail. insertrow (tblflowcarddetail. Rows. Length );
VaR Col = row. insertcell (0 );
Col. innerhtml = "<input type = \" Hidden \ "name = \" aiminnerid \ "id = \" aiminnerid \ "> <input type = button value =... name = btnselectaimclient Index = \ "" + rowindex + "\"> ";
Col = row. insertcell (1 );
Col. innerhtml = "<input id = aimname name = aimname size = 25 maxlength = 25 readonly = \" True \ "> ";
Col = row. insertcell (2 );
Col. innerhtml = "<input type = 'button 'value = 'delete' id = btndeleteline name = btndeleteline onclick = \" Return deleterow ('row "+ rowindex + "') \ "> ";
Row. setattribute ("ID", "row" + rowindex );
Rowindex ++;
}
Function deleterow (rowtag ){
VaR I = tblflowcarddetail. Rows (rowtag). rowindex;
VaR J;
For (j = I; j <= rowindex; j ++ ){
Tblflowcarddetail. Rows (j). cells (0). All ("btnselectaimclient"). Index --;
Tblflowcarddetail. Rows (j). cells (2). All ("btnselectitem"). Index --;
}
Tblflowcarddetail. deleterow (I );
Rowindex --;
}
</SCRIPT>
<Body>
<Table>
<Tr>
<TD> cell0 </TD>
<TD> cell1 </TD>
<TD> cell2 </TD>
</Tr>
</Table>
<Input name = "btnaddline" type = "button" id = "btnaddline" onclick = "Return addonelineonclick ()" value = "add a row">
</Body>
Example 2:
<Body>
<Form action = "<% = PATH %>/news. do? Method = Add "method =" Post "enctype =" multipart/form-Data ">
<Input type = "hidden" name = "ID" value = "$ {NEWS. ID}">
<Table width = "90%" border = "0" align = "Left" cellpadding = "0" cellspacing = "1" class = "newtable">
<Tr>
<TD class = "newtd"> News Title </TD>
<TD class = "newtd"> <input type = "text" name = "title" size = "30"> </TD>
</Tr>
<Tr>
<TD class = "newtd"> News subtitle </TD>
<TD class = "newtd"> <input type = "text" name = "subtitle" size = "30"> </TD>
</Tr>
<Tr>
<TD class = "newtd"> news content </TD>
<TD class = "newtd"> <textarea class = "ckeditor" name = "content"> </textarea> </TD>
</Tr>
<Tr>
<TD class = "newtd"> news images </TD>
<TD class = "newtd" id = "more"> <input type = "file" name = "uploadfile [0]. file "size =" 30 "> <input type =" button "onclick =" AddFile (); "value =" add "> </TD>
</Tr>
<Tr>
<TD class = "newtd"> News section </TD>
<TD class = "newtd">
<Select id = "modelselect" name = "modelid">
</SELECT>
</TD>
</Tr>
<Tr>
<TD align = "center" colspan = "2">
<Input type = "Submit" value = "save"> & nbsp;
<Input type = "reset" value = "reset">
</TD>
</Tr>
</Table>
</Form>
<SCRIPT type = "text/JavaScript">
VaR T = 1;
Function AddFile ()
{
VaR parent = Document. getelementbyid ("more ");
VaR BR = Document. createelement ("Br ");
VaR input = Document. createelement ("input ");
VaR button = Document. createelement ("input ");
Input. type = "file ";
Input. Name = "uploadfile [" + (T ++) + "]. File ";
Input. size = "30 ";
Button. type = "button ";
Button. value = "delete ";
Button. onclick = function ()
{
Parent. removechild (BR );
Parent. removechild (input );
Parent. removechild (button );
};
Parent. appendchild (BR );
Parent. appendchild (input );
Parent. appendchild (button );
}
</SCRIPT>
</Body>