1 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en">2 <HTML>3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8">5 <Scripttype= "Text/javascript"src=".. /js/jquery-1.8.2.js "></Script>6 </Head>7 <Body>8 <TableID= "TableID"Border= "1"Align= "Center"width= "60%">9 <thead>Ten <TR> One <th>User name</th> A <th>Password</th> - <th>Operation</th> - </TR> the </thead> - <tbodyID= "Tbodyid"> - <!--dynamically increasing rows - - </tbody> + </Table> - <HR/> +User name:<inputtype= "text"ID= "Usernameid"/> APassword:<inputtype= "text"ID= "Passwordid"/> at <inputtype= "button"value= "Add"ID= "Addid"/> - </Body> - <Scripttype= "Text/javascript"> - $("#addID"). Click (function(){ - //get user name and password - varusername= $("#usernameID"). Val (); in varPassword= $("#passwordID"). Val (); - //Go to Space to username=$.trim (username); + Password=$.trim (password); - //Judging the if(username!=NULL &&Password!=NULL &&Username.length>0 &&Password.length>0){ * //To Create a TR object $ var$tr= $("<tr></tr>")Panax Notoginseng //Create 3 TD objects - var$TD 1= $("<td>" +username+ "</td>"); the var$TD 2= $("<td>" +Password+ "</td>"); + var$TD 3= $("<td></td>"); A //Create button the var$delButton= $("<input type= ' button ' value= ' delete ' >"); + - //Add a button to a TD object to form a parent-child relationship $ $td 3.append ($delButton); $ //Add a Click event for a button - $delButton. Click (function(){ - $tr. Remove (); the }); - //add a TD object to a TR object to form a parent-child relationshipWuyi $tr. Append ($td 1); the $tr. Append ($td 2); - $tr. Append ($td 3); Wu //Add a Tr object to a Tbody object to form a parent-child relationship - $("#tbodyID"). Append ($tr); About //clear the original user name and password box $ $("#usernameID"). Val (""); - $("#passwordID"). Val (""); - }Else{ - Window.alert ("user name and password required"); A } + }); the </Script> - </HTML>