टेबल टीबॉडीज संग्रह
उदाहरण
पता लगाएँ कि एक तालिका में कितने <tbody> तत्व हैं:
var x = document.getElementById("myTable").tBodies.length;
एक्स का परिणाम होगा:
2
नीचे और अधिक "इसे स्वयं आज़माएं" उदाहरण।
परिभाषा और उपयोग
tBodies संग्रह एक तालिका में सभी <tbody> तत्वों का संग्रह देता है।
नोट: संग्रह में तत्वों को सॉर्ट किया जाता है जैसे वे स्रोत कोड में दिखाई देते हैं।
ब्राउज़र समर्थन
Collection | |||||
---|---|---|---|---|---|
tBodies | Yes | Yes | Yes | Yes | Yes |
वाक्य - विन्यास
tableObject.tBodies
गुण
Property | Description |
---|---|
length | Returns the number of <tbody> elements in the collection. Note: This property is read-only |
तरीकों
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 |
टेक्निकल डिटेल
डोम संस्करण: | कोर स्तर 2 दस्तावेज़ वस्तु |
---|---|
प्रतिलाभ की मात्रा: | एक HTMLCollection ऑब्जेक्ट, <table> तत्व में सभी <tbody> तत्वों का प्रतिनिधित्व करता है। संग्रह में तत्वों को क्रमबद्ध किया जाता है क्योंकि वे स्रोत कोड में दिखाई देते हैं |
और ज्यादा उदाहरण
उदाहरण
[ सूचकांक ]
तालिका में पहले <tbody> तत्व (इंडेक्स 0) के आंतरिक HTML को अलर्ट करें:
alert(document.getElementById("myTable").tBodies[0].innerHTML;
उदाहरण
आइटम ( सूचकांक )
तालिका में पहले <tbody> तत्व (इंडेक्स 0) के आंतरिक HTML को अलर्ट करें:
alert(document.getElementById("myTable").tBodies.item(0).innerHTML);
उदाहरण
नामित आइटम ( आईडी )
तालिका में id="myTBody" के साथ <tbody> तत्व के आंतरिक HTML को अलर्ट करें:
alert(document.getElementById("myTable").tBodies.namedItem("myTBody").innerHTML);
संबंधित पृष्ठ
HTML संदर्भ: HTML <tbody> टैग
टेबल ऑब्जेक्ट