طريقة إنشاء الجدول ()
مثال
قم بإنشاء عنصر <tfoot> (وقم بإدخال عنصر <tr> و <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>";
التعريف والاستخدام
تنشئ طريقة createTFoot () عنصرًا فارغًا <tfoot> وتضيفه إلى الجدول.
ملاحظة: إذا كان عنصر <tfoot> موجودًا بالفعل في الجدول ، فإن طريقة createTFoot () ترجع العنصر الحالي ، ولا تنشئ عنصرًا جديدًا.
ملاحظة: يجب أن يحتوي عنصر <tfoot> على علامة <tr> واحدة أو أكثر بداخله.
نصيحة: لإزالة عنصر <tfoot> من جدول ، استخدم طريقة deleteTFoot () .
دعم المتصفح
Method | |||||
---|---|---|---|---|---|
createTFoot() | Yes | Yes | Yes | Yes | Yes |
بناء الجملة
tableObject.createTFoot()
المعلمات
لا أحد |
تفاصيل تقنية
قيمة الإرجاع: | عنصر <tfoot> المنشأ حديثًا (أو الموجود) |
---|
مزيد من الأمثلة
مثال
قم بإنشاء وحذف عنصر <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();
}
الصفحات ذات الصلة
مرجع HTML: علامة HTML <tfoot>
❮ كائن الجدول