<%@ Page language="C #"autoeventwireup="true"Codebehind="StuInfo.aspx.cs"inherits="Stumanager.stuinfo"%><! DOCTYPE html>"http://www.w3.org/1999/xhtml">"Server"><meta http-equiv="Content-type"Content="text/html; Charset=utf-8"/> <title>add Student info</title> <style type="Text/css">#div1 {width:300px; height:300px; border:1px; } </style> <script type="Text/javascript">//Perform the deletefunction Ben_delete (delrow) {//get the line of the click TR varTR =DelRow.parentNode.parentNode; //Delete a child row in a tbodydocument.getElementById ('tbody1'). removechild (TR); } window.onload=function () {document.getElementById ("Btn_save"). onclick =function () {//get new Line contents varName = document.getElementById ("name"). Value; varAge = document.getElementById (" Age"). Value; varTbaleobj = document.getElementById ("tbody1"); //Add a new row at the top varAddRow = Tbaleobj.insertrow (-1); //Insert data for a new rowAddrow.insertcell (-1). InnerHTML =name; Addrow.insertcell (-1). InnerHTML =name; //Add a button to a new lineAddrow.insertcell (-1). InnerHTML ='<input type= "button" id= "Btn_del" value= "delete" onclick= "ben_delete (this);" />'; }; }; </script>"Form1"runat="Server"> <fieldset style="width:250px;"> <divclass="#div1">Name:<input type="TextBox"Id="name"Name="user_name"Value=" "/><br/>Age :<input type="TextBox"Id=" Age"Name="User_age"Value=" "/><br/> <input type="Button"Id="Btn_save"Name="Btn_save"Value="Save"style="margin-left:180px;margin-top:-10px;""/></div> </fieldset> <div> <table border="1px"style="width:220px;"> <thead> <tr><td colspan="3">student Info table</td></tr> <tr><td>name</td><td>age</td> ;<td>delete</td></tr> </thead> <tbody id="tbody1"> </tbody> </table> </div> </form></body>View Code JavaScript Add delete line information