Tablo tBodies Koleksiyonu
Örnek
Bir tabloda kaç tane <tbody> öğesi olduğunu öğrenin:
var x = document.getElementById("myTable").tBodies.length;
x'in sonucu şöyle olacaktır:
2
Aşağıda daha fazla "Kendiniz Deneyin" örnekleri.
Tanım ve Kullanım
tBodies koleksiyonu, bir tablodaki tüm <tbody> öğelerinin bir koleksiyonunu döndürür.
Not: Koleksiyondaki öğeler, kaynak kodda göründükleri gibi sıralanır.
Tarayıcı Desteği
Collection | |||||
---|---|---|---|---|---|
tBodies | Yes | Yes | Yes | Yes | Yes |
Sözdizimi
tableObject.tBodies
Özellikler
Property | Description |
---|---|
length | Returns the number of <tbody> elements in the collection. Note: This property is read-only |
yöntemler
Method | Description |
---|---|
[index] | Returns the <tbody> element from the collection with the specified index (starts at 0). Note: Returns null if the index number is out of range |
item(index) | Returns the <tbody> element from the collection with the specified index (starts at 0). Note: Returns null if the index number is out of range |
namedItem(id) | Returns the <tbody> element from the collection with the specified id. Note: Returns null if the id does not exist |
Teknik detaylar
DOM Sürümü: | Çekirdek Düzey 2 Belge Nesnesi |
---|---|
Geri dönüş değeri: | <table> öğesindeki tüm <tbody> öğelerini temsil eden bir HTMLCollection Nesnesi. Koleksiyondaki öğeler, kaynak kodda göründükleri gibi sıralanır. |
Daha fazla örnek
Örnek
[ dizin ]
Tablodaki ilk <tbody> öğesinin (index 0) innerHTML'sini uyarın:
alert(document.getElementById("myTable").tBodies[0].innerHTML;
Örnek
öğe ( dizin )
Tablodaki ilk <tbody> öğesinin (index 0) innerHTML'sini uyarın:
alert(document.getElementById("myTable").tBodies.item(0).innerHTML);
Örnek
nameItem( id )
Tabloda id="myTBody" ile <tbody> öğesinin innerHTML'sini uyarın:
alert(document.getElementById("myTable").tBodies.namedItem("myTBody").innerHTML);
İlgili Sayfalar
HTML referansı: HTML <tbody> etiketi
❮ Tablo Nesnesi