例 2.5(delTRTDIEFF.html)
<HTML>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<TITLE> </TITLE>
</HEAD>
<BODY>
<input id="row" type="text" size="2"/>行,
<input id="dellastrow" type="button" value="删行"/><br/>
<input id="column" type="text" size="2"/>列
<input id="delrowcell" type="button" value="删最后一行的某一格"/><br/><br/>
<TABLE id="test" border="1" style="border-collapse:collapse">
<TR>
<TD>11</TD>
<TD>12</TD>
<TD>13</TD>
<TD>14</TD>
</TR>
<TR>
<TD>21</TD>
<TD>22</TD>
<TD>23</TD>
<TD>24</TD>
</TR>
<TR>
<TD>31</TD>
<TD>32</TD>
<TD>33</TD>
<TD>34</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<script>
var tab = document.getElementById("test");
function dellastrow()
{
/*
TABLE.deleteRow(anIndex) (Method)
Deletes a specified row within the TABLE object.
Argument list: anIndex The row to delete
*/
var row = document.getElementById("row").value ;
tab.deleteRow(row - 1);
}
function delrowcell()
javascript当中delTRTDIEFF的用法
猜你喜欢
转载自blog.csdn.net/mark_to_win/article/details/88681596
今日推荐
周排行