deleteRow

王朝百科·作者佚名  2010-02-21  
宽屏版  字体: |||超大  

语法:

object . deleteRow ( iIndex )

参数:

iIndex :可选项。整数值(Integer)。指定从表格内删除的行的序号。如果忽略此参数,默认将删除 rows 集合内的最后一个。

返回值:

说明:

从 object 中删除指定的行(Row)。也即从 rows 集合中删除指定的项目( tr )。

指定的行从 tFoot , tBody , tHead 中删除,也同时从 table 的 rows 集合中删除。此时 iIndex 应该是表示 tr 的 sectionRowIndex 属性。

指定的行从 table 中删除,等于从 tBody 的 rows 集合中删除。此时 iIndex 应该是表示 tr 的 rowIndex 属性。

<script>

var i_nowheight=280;

function rdl_doOver(e){

event.cancelBubble=true;

with (event.srcElement.parentElement) {

if (tagName.toLowerCase()=="tr") {

document.all("id_note").innerHTML="选定的行在<font color=#FF3300>"+parentElement.tagName.toUpperCase()+"</font>中。<br>"+"sectionRowIndex=<b>"+sectionRowIndex.toString()+"</b>&nbsp;&nbsp;&nbsp;rowIndex=<b>"+rowIndex.toString();+"</b>";

} else { document.all("id_note").innerHTML="请将鼠标移到上方的表格中查看信息。<br>单击将删除选定的行。";}

}

}

document.onmouseover=rdl_doOver;

function rdl_delRow(e){

event.cancelBubble=true;

with (event.srcElement.parentElement) {

if (tagName.toLowerCase()=="tr") myTable.deleteRow(rowIndex);

i_nowheight-=20;

window.resizeTo(360,i_nowheight);

}

}

</script>

<table cellspacing=1 id=myTable onclick="rdl_delRow();">

<thead><tr id=myTR><td>THEAD的第1个TD</td><td>THEAD的第1个TD</td><td>THEAD的第1个TD</td></tr></thead>

<tbody><tr id=myTR><td>TBODY的第1个TD</td><td>TBODY的第2个TD</td><td>TBODY的第3个TD</td></tr>

<tr id=myTR><td>TBODY的第4个TD</td><td>TBODY的第5个TD</td><td>TBODY的第6个TD</td></tr></tbody>

<tfoot><tr id=myTR><td>TFOOT的第1个TD</td><td>TFOOT的第1个TD</td><td>TFOOT的第1个TD</td></tr></tfoot>

</table>

<br><div id=id_note></div>

 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝百科 版权所有