Copy codeThe Code is as follows:
<PRE class = html name = "code"> <Head id = "Head1" runat = "server">
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Link href = "../esstec_css/style.css" type = "text/css" rel = "stylesheet" media = "all"/>
<Link href = "../esstec_css/style.nk.css" rel = "stylesheet" type = "text/css"/>
<Script src = "./js/jquery-1.7.2.min.js" type = "text/javascript"> </script>
<Link href = "../esstec_css/Default.css" rel = "stylesheet" type = "text/css"/>
<Link href = "../esstec_css/BMS-Form.css" rel = "stylesheet" type = "text/css"/>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("# SelEmployee"). click (function (){
Var $ table = $ ("# tbProEmployee tr ");
Var len = $ table. length;
Var trid = "tbProEmployee" + len;
Var strDeviceTr = "<tr id =" + trid + "> ";
StrDeviceTr + = "<td> <input id = \" txtEmployeeInnerID \ "type = \" hidden \ "name = \" ProjectEmployee \ "value = \" "+" 123 "+ "\"/> <input id = \ "txtInnerID \" type = \ "hidden \" name = \ "ProjectEmployee \" value = \ "\"/> ";
StrDeviceTr + = "<label id = \" txtEmployeeName \ ">" + "name" + "</label> </td> ";
StrDeviceTr + = "<td> <input id = \" txtRemark \ "type = \" text \ "name = \" ProjectEmployee \ "/> </td> ";
StrDeviceTr + = "<td> <a href = \" javascript:; SaveProEmployee ('"+ trid + "') \ "> Save </a> | <a href = \" javascript:; DelProEmployee ('"+ trid + "') \ "> Delete </a> </td> ";
StrDeviceTr + = "</tr> ";
$ ("# TbProEmployee"). append (strDeviceTr );
});
});
Function SaveProEmployee (index ){
// Save with ajax
Var tr = $ ("tr [id =" + index + "]");
Var employee = tr. find ("# txtEmployeeName"). text ();
Var remark = tr. find ("# txtRemark"). val ();
Var strtd = "<td> <input id = \" txtEmployeeInnerID \ "type = \" hidden \ "name = \" ProjectEmployee \ "value = \" "+" 123 "+ "\"/> <input id = \ "txtInnerID \" type = \ "hidden \" name = \ "ProjectEmployee \" value = \ "\"/> ";
Strtd + = "<label id = \" txtEmployeeName \ ">" + employee + "</label> </td> ";
Strtd + = "<td> <label id = \" txtRemark \ ">" + remark + "</label> </td> ";
Strtd + = "<td> <a href = \" javascript:; UpdateProEmployee ('"+ index + "') \ "> modify </a> | <a href = \" javascript:; DelProEmployee ('"+ index + "') \ "> Delete </a> </td> ";
Tr.html (strtd );
}
Function UpdateProEmployee (index ){
// Save with ajax
Var tr = $ ("tr [id =" + index + "]");
Var employee = tr. find ("# txtEmployeeName"). text ();
Var remark = tr. find ("# txtRemark"). text ();
Var strtd = "<td> <input id = \" txtEmployeeInnerID \ "type = \" hidden \ "name = \" ProjectEmployee \ "value = \" "+" 123 "+ "\"/> <input id = \ "txtInnerID \" type = \ "hidden \" name = \ "ProjectEmployee \" value = \ "\"/> ";
Strtd + = "<label id = \" txtEmployeeName \ ">" + employee + "</label> </td> ";
Strtd + = "<td> <input id = \" txtRemark \ "type = \" text \ "name = \" ProjectEmployee \ "value = \" "+ remark + "\ "/> </td> ";
Strtd + = "<td> <a href = \" javascript:; SaveProEmployee ('"+ index + "') \ "> Save </a> | <a href = \" javascript:; DelProEmployee ('"+ index + "') \ "> Delete </a> </td> ";
Tr.html (strtd );
}
Function DelProEmployee (index ){
If (confirm ("Are you sure? ")){
$ ("Tr [id =" + index + "]"). remove ();
}
}
</Script>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div class = "snippet download-list">
<Table class = "telerik-reTable-2" id = "tbProEmployee">
<Tbody>
<Tr>
<Th colspan = "3">
[<A id = "selEmployee" href = "javascript: void (0)"> operator </a>]
</Th>
</Tr>
<Tr>
<Th>
Name
</Th>
<Th>
Remarks
</Th>
<Th>
Operation
</Th>
</Tr>
</Tbody>
</Table>
</Div>
</Form>
</Body>
</Html> </PRE> <BR>
<BR>
<PRE> </PRE>
<PRE> </PRE>