WorldSoftware  
世界軟件,軟件的世界!
 

一、insertRow 方法

語法:oTR = object.insertRow([iIndex])

說明: iIndex 可選項,默認為-1,即默認插入到表的最後一行。

返回值:如果成功,返回一對TR元素,否則返回Null

二、insertBefore 方法

語法:oElement = object.insertBefore(oNewNode [, oChildNode])

說明:

oNewNode

必選項,要插入到父對象裡的節點對象,這裡指要插入到表格裡的行對象。可以用 createElementcloneNode方法來創建行對象.

oChildNode

可選項,目標對象要插入到該對象前。


2.1cloneNode 方法

語法:oClone = object.cloneNode([bCloneChildren])

說明:bCloneChildren可選項,布爾類型,True則連帶子結點一起拷貝,否則不拷貝。默認為False

2.2createElement方法

語法:oElement = document.createElement(sTag)

說明: sTag :必選項,要新增的標記名


舉例代碼:

RowsLen=document.all("tblTarget").rows.length; //得到表格的行數

document.all(
"tblTarget").children(0).insertBefore

(document.all(
"tblTarget").rows(1).cloneNode(true),document.all("tblTarget").rows(RowsLen-1)); //新增一行

 


三、deleteRow 方法

語法:object.deleteRow([iRowIndex])

說明: iRowIndex :可選項,整型,要刪除的行的索引。默認刪除最後一行。



posted on 2006-08-09 20:08  WorldNet  阅读(1367)  评论(0编辑  收藏  举报