中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

tr insertCell() 方法

tr 對象參考手冊 tr 對象

定義和用法

insertCell() 方法用于在 HTML 表的一行的指定位置插入一個空的 <td> 元素。

語法

trObject.insertCell(index)
描述
index 該方法將創(chuàng)建一個新的 <td> 元素,把它插入行中指定的位置。新單元格將被插入當(dāng)前位于 index 指定位置的表元之前。如果 index 等于行中的單元格數(shù),則新單元格被附加在行的末尾。

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流瀏覽器都支持 insertCell() 方法


實例

實例

下面的例子在表格行中插入了一個單元格:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</title>
<script>
function displayResult(){
????var firstRow=document.getElementById("myTable").rows[0];
????var x=firstRow.insertCell(-1);
????x.innerHTML="New cell"
}
</script>
</head>
<body>

<table id="myTable" border="1">
????<tr>
????????<td>First cell</td>
????????<td>Second cell</td>
????????<td>Third cell</td>
????</tr>
</table>
<br>
<button type="button" onclick="displayResult()">插入單元格</button>

</body>
</html>

運行代碼 ?

實例s

更多實例

向表格添加新行 - 然后添加單元格和內(nèi)容


tr 對象參考手冊 tr 對象其他擴(kuò)展