Esempio
Creare un <tfoot> elemento (and insert a <tr> and <td> element to it) :
// 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>";
Prova tu stesso " Definizione e l'utilizzo
Il createTFoot() metodo crea un vuoto <tfoot> elemento e lo aggiunge alla tabella.
Note: Se un <tfoot> elemento esiste già sul tavolo, il createTFoot() restituisce quello esistente, e non crea una nuova.
Nota: Il <tfoot> elemento deve avere uno o più <tr> tag all'interno.
Tip: Per rimuovere il <tfoot> elemento da una tabella, utilizzare il deleteTFoot() metodo.
Supporto browser
Metodo | |||||
---|---|---|---|---|---|
createTFoot() | sì | sì | sì | sì | sì |
Sintassi
tableObject .createTFoot()
parametri
Nessuna |
Dettagli tecnici
Valore di ritorno: | La nuova creazione (or an existing) <tfoot> elemento |
---|
Altri esempi
Esempio
Creare ed eliminare un <tfoot> elemento:
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();
}
Prova tu stesso " Pagine correlate
Di riferimento HTML: HTML <tfoot> tag
<Tabella Object