Table createTFoot() 方法
定义和用法
createTFoot()
方法创建空的 <tfoot> ਐਲੀਮੈਂਟ 并将其添加到表中。
注释:如果表中已经存在
元素,则 createTFoot()
方法返回现有元素,而不创建新元素。
注释:
元素内部必须有一个或多个 标签。
提示:如需从表中删除
元素,请使用 deleteTFoot() 方法。
另请参阅:
HTML 参考手册:HTML <tfoot> ਟੈਗ
实例
例子 1
创建
元素(并在其中插入 和 元素):
// 查找 id="myTable" 的 元素:
var table = document.getElementById("myTable");
// 创建空的 元素并将其添加到表中:
var footer = table.createTFoot();
// ਖਾਲੀ <tr> ਐਲੀਮੈਂਟ ਬਣਾਓ ਅਤੇ <tfoot> ਦੇ ਪਹਿਲੇ ਸਥਾਨ ਵਿੱਚ ਜੋੜੋ:
var row = footer.insertRow(0);
// "ਨਵੇਂ" <tr> ਐਲੀਮੈਂਟ ਦੇ ਪਹਿਲੇ ਸਥਾਨ ਵਿੱਚ ਨਵਾਂ ਸੈੱਲ (<td>) ਜੋੜੋ:
var cell = row.insertCell(0);
// ਨਵੇਂ ਸੈੱਲ ਵਿੱਚ ਬੋਲਡ ਟੈਕਸਟ ਜੋੜੋ:
cell.innerHTML = "<b>This is a table footer</b>";
ਆਪਣੇ ਅਨੁਭਵ ਕਰੋ
ਉਦਾਹਰਣ 2
ਸਥਾਪਤ ਅਤੇ ਹਟਾਉਣ ਲਈ <tfoot> ਐਲੀਮੈਂਟ:
function myCreateFunction() {
var table = document.getElementById("myTable");
var footer = table.createTFoot();
var row = footer.insertRow(0);
var cell = row.insertCell(0);
cell.innerHTML = "<b>This is a table footer</b>";
}
function myDeleteFunction() {
document.getElementById("myTable").deleteTFoot();
}
ਆਪਣੇ ਅਨੁਭਵ ਕਰੋ
ਸਕ੍ਰਿਪਟ:
tableObject.createTFoot()
ਪੈਰਾਮੀਟਰ
ਨਹੀਂ ਹੈ。
ਬਰਾਉਜ਼ਰ ਸਮਰਥਨ
ਚਰਮ |
ਐਂਜਲ |
ਫਾਇਰਫਾਕਸ |
ਸੈਫਾਰੀ |
ਓਪੇਰਾ |
ਚਰਮ |
ਐਂਜਲ |
ਫਾਇਰਫਾਕਸ |
ਸੈਫਾਰੀ |
ਓਪੇਰਾ |
ਸਮਰਥਨ |
ਸਮਰਥਨ |
ਸਮਰਥਨ |
ਸਮਰਥਨ |
ਸਮਰਥਨ |
|