<% @ Page Language = " C # " Autoeventwireup = " True " Codefile = " Test. aspx. CS " Inherits = " Test " %>
<! Doctype HTML public"-// W3C // dtd xhtml 1.0 transitional // en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = " Http://www.w3.org/1999/xhtml " >
<Head>
<Title> </title>
<SCRIPT src = " JS/jquery-1.4.1.min.js " Mce_src = " JS/jquery-1.4.1.min.js " Type = " Text/JavaScript " > </SCRIPT>
<SCRIPT type = " Text/JavaScript " >
Function addcol (){
$ Col = $ (" <TD> added columns </TD> " );
$ ( " # Tab1> tbody> tr " ). Append ($ col );
}
Function delcol (){
// Remove the last column
$ ( " # Tab1 TR: Last-child " ). Remove ();
// Remove the first column
// $ ("# Tab1 TR: First-Child"). Remove ();
// Remove the specified column. Note: This index starts from 1.
// $ ("# Tab1 TR: Nth-child (2)"). Remove ();
// Remove a column other than the first column
// $ ("# Tab1 TR: Not (: Nth-Child (1)"). Remove ();
}
</SCRIPT>
</Head>
<Body>
<Input id = " Button1 " Type = " Button " Onclick = " Addcol () " Value = " Add Column " />
<Input id = " Button2 " Type = " Button " Onclick = " Delcol () " Value = " Reduce Column " />
<Table id = " Tab1 " Border = " 1 " Style = " Width: 200px; " >
<Tbody>
<Tr>
<TD> 1 </TD>
<TD> Hello </TD>
</Tr>
<Tr>
<TD> 2 </TD>
<TD> world </TD>
</Tr>
<Tr>
<TD> 3 </TD>
<TD> Prince pie </TD>
</Tr>
</Tbody>
</Table>
</Body>
</Html>