Dom deletes table row and column instances

Source: Internet
Author: User

<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<title>dom Delete table row and column instances </title>


<body>
<table id= "table1" bordercolor= "#000000" width= "" border= "1" >
<tbody>
<tr>
<td>00</td>
<td>01</td>
<td>02</td>
<td>03</td>
</tr>
<tr>
<td>10</td>
<td>11</td>
<td>12</td>
<td>13</td>
</tr>
<tr>
<td>20</td>
<td>21</td>
<td>22</td>
<td>23</td>
</tr>
<tr>
<td>30</td>
<td>31</td>
<td>32</td>
<td>33</td>
</tr>
<tr>
<td>40</td>
<td>41</td>
<td>42</td>
<td>43</td>
</tr>
</tbody>
</table>
<br/>
<input type= "button" value= "Delete Row" onclick= "DeleteRow ()"/>&nbsp; &nbsp;
<input type= "button" value= "delete a column" onclick= "DeleteColumn ()"/>
</body>
<script language= "JavaScript" type= "Text/javascript" >
<!--
Get Table objects
var _table=document.getelementbyid ("Table1");

Defines a function to delete the first row
function DeleteRow () {
_table.deleterow (0);
}
Defines a function to delete the first column
function DeleteColumn () {
Deleting a column requires column deletion for each row
for (Var i=0;i<_table.rows.length;i++) {
_table.rows[i].deletecell (0);
}
}
-->
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.