ဇယား createTHhead() နည်းလမ်း
ဥပမာ
<thead> ဒြပ်စင်တစ်ခုဖန်တီးပါ (ပြီး <tr> နှင့် <td> ဒြပ်စင်တစ်ခုကို ၎င်းသို့ထည့်ပါ)
// Find a <table> element with id="myTable":
var table = document.getElementById("myTable");
// Create an empty <thead> element and add it to the table:
var header = table.createTHead();
// Create an empty <tr> element and add it to the first position of <thead>:
var row = header.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 header</b>";
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
createTHhead() နည်းလမ်းသည် ဗလာ <thead> ဒြပ်စင်တစ်ခုကို ဖန်တီးပြီး ၎င်းကို ဇယားတွင် ထည့်သည်။
မှတ်ချက်- <thead> ဒြပ်စင်တစ်ခုသည် ဇယားပေါ်တွင် ရှိနှင့်ပြီးဖြစ်ပါက createTHhead() နည်းလမ်းသည် ရှိပြီးသားတစ်ခုကို ပြန်ပို့ပေးပြီး အသစ်တစ်ခုကို ဖန်တီးမည်မဟုတ်ပါ။
မှတ်ချက်- <thead> ဒြပ်စင်တွင် တစ်ခု သို့မဟုတ် တစ်ခုထက်ပိုသော <tr> တဂ်များ ရှိရပါမည်။
အကြံပြုချက်- ဇယားတစ်ခုမှ <thead> ဒြပ်စင်ကို ဖယ်ရှားရန်၊ deleteTHead() နည်းလမ်းကို အသုံးပြုပါ။
Browser ပံ့ပိုးမှု
Method | |||||
---|---|---|---|---|---|
createTHead() | Yes | Yes | Yes | Yes | Yes |
အထားအသို
tableObject.createTHead()
ကန့်သတ်ချက်များ
တစ်ခုမှ |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | အသစ်ဖန်တီးထားသော (သို့မဟုတ် ရှိပြီးသား) <thead> ဒြပ်စင် |
---|
နောက်ထပ် ဥပမာများ
ဥပမာ
<thead> ဒြပ်စင်တစ်ခုကို ဖန်တီးပြီး ဖျက်ပါ-
function myCreateFunction() {
var table = document.getElementById("myTable");
var header = table.createTHead();
var row = header.insertRow(0);
var cell = row.insertCell(0);
cell.innerHTML = "<b>This is a table header</b>";
}
function myDeleteFunction() {
document.getElementById("myTable").deleteTHead();
}
ဆက်စပ်စာမျက်နှာများ
HTML ရည်ညွှန်း- HTML <thead> တဂ်
❮ ဇယားအရာဝတ္ထု