ဇယား tBodies စုဆောင်းမှု
ဥပမာ
ဇယားတစ်ခုတွင် <tbody> အစိတ်အပိုင်း မည်မျှရှိသည်ကို ရှာဖွေပါ-
var x = document.getElementById("myTable").tBodies.length;
x ၏ရလဒ်သည် -
2
အောက်တွင် နောက်ထပ် "စမ်းသုံးကြည့်ပါ" ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
tBodies စုဆောင်းမှုသည် ဇယားတစ်ခုရှိ <tbody> အစိတ်အပိုင်းအားလုံး၏ အစုအဝေးကို ပြန်ပေးသည်။
မှတ်ချက်- အရင်းအမြစ်ကုဒ်တွင် ပေါ်လာသည်နှင့်အမျှ စုစည်းမှုရှိ အစိတ်အပိုင်းများကို စီထားသည်။
Browser ပံ့ပိုးမှု
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 |
နည်းပညာဆိုင်ရာအသေးစိတ်
DOM ဗားရှင်း- | Core Level 2 Document Object |
---|---|
ပြန်ပို့တန်ဖိုး- | <table> ဒြပ်စင်ရှိ <tbody> ဒြပ်စင်အားလုံးကို ကိုယ်စားပြုသော HTMLCollection Object တစ်ခု။ အရင်းအမြစ်ကုဒ်တွင် ပေါ်လာသည်နှင့်အမျှ စုစည်းမှုရှိ အစိတ်အပိုင်းများကို စီထားသည်။ |
နောက်ထပ် ဥပမာများ
ဥပမာ
[ အညွှန်း ]
ဇယားရှိ ပထမ <tbody> ဒြပ်စင် (အညွှန်းကိန်း 0) ၏ အတွင်း HTML အား သတိပေးချက်-
alert(document.getElementById("myTable").tBodies[0].innerHTML;
ဥပမာ
ပစ္စည်း( အညွှန်း )
ဇယားရှိ ပထမ <tbody> ဒြပ်စင် (အညွှန်းကိန်း 0) ၏ အတွင်း HTML အား သတိပေးချက်-
alert(document.getElementById("myTable").tBodies.item(0).innerHTML);
ဥပမာ
အမည်ရှိပစ္စည်း( id )
ဇယားရှိ id="myTBody" ဖြင့် <tbody> ဒြပ်စင်၏ အတွင်း HTML ကို သတိပေးပါ-
alert(document.getElementById("myTable").tBodies.namedItem("myTBody").innerHTML);
ဆက်စပ်စာမျက်နှာများ
HTML ရည်ညွှန်း- HTML <tbody> တဂ်
❮ ဇယားအရာဝတ္ထု