Tabela CreateTFoot() Metoda
Przykład
Utwórz element <tfoot> (i wstaw do niego element <tr> i <td>):
// 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>";
Definicja i użycie
Metoda createTFoot() tworzy pusty element <tfoot> i dodaje go do tabeli.
Uwaga: Jeśli element <tfoot> już istnieje w tabeli, metoda createTFoot() zwraca istniejący i nie tworzy nowego.
Uwaga: Element <tfoot> musi zawierać jeden lub więcej znaczników <tr> wewnątrz.
Wskazówka: Aby usunąć element <tfoot> z tabeli, użyj metody deleteTFoot() .
Obsługa przeglądarki
Method | |||||
---|---|---|---|---|---|
createTFoot() | Yes | Yes | Yes | Yes | Yes |
Składnia
tableObject.createTFoot()
Parametry
Nic |
Szczegóły techniczne
Wartość zwrotu: | Nowo utworzony (lub istniejący) element <tfoot> |
---|
Więcej przykładów
Przykład
Utwórz i usuń element <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();
}
Powiązane strony
Odniesienie HTML: tag HTML <tfoot>
❮ Obiekt tabeli