Tabel createTFoot() Metode
Voorbeeld
Skep 'n <tfoot>-element (en voeg 'n <tr>- en <td>-element daarby in):
// Find a <table> element with id="myTable":
var table = document.getElementById("myTable");
// Create an empty <tfoot> element and add it to the table:
var footer = table.createTFoot();
// Create an empty <tr> element and add it to the first position of <tfoot>:
var row = footer.insertRow(0);
// Insert a new cell (<td>) at the first position of the "new" <tr> element:
var cell = row.insertCell(0);
// Add some bold text in the new cell:
cell.innerHTML = "<b>This is a table footer</b>";
Definisie en gebruik
Die createTFoot()-metode skep 'n leë <tfoot>-element en voeg dit by die tabel.
Let wel: As 'n <tfoot> element reeds op die tabel bestaan, gee die createTFoot() metode die bestaande een terug, en skep nie 'n nuwe een nie.
Let wel: Die <tfoot>-element moet een of meer <tr>-merkers binne hê.
Wenk: Om die <tfoot>-element uit 'n tabel te verwyder, gebruik die deleteTFoot() metode.
Blaaierondersteuning
Method | |||||
---|---|---|---|---|---|
createTFoot() | Yes | Yes | Yes | Yes | Yes |
Sintaksis
tableObject.createTFoot()
Grense
Geen |
Tegniese besonderhede
Terugkeerwaarde: | Die nuutgeskepte (of 'n bestaande) <tfoot>-element |
---|
Meer voorbeelde
Voorbeeld
Skep en skrap 'n <tfoot>-element:
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();
}
Verwante bladsye
HTML verwysing: HTML <tfoot> tag
❮ Tabelvoorwerp