HTML DOM Script Object
ဇာတ်ညွှန်းအရာဝတ္ထု
Script object သည် HTML <script> element ကို ကိုယ်စားပြုသည်။
Script Object ကို ဝင်သုံးပါ။
getElementById() ကို အသုံးပြု၍ <script> ဒြပ်စင်တစ်ခုကို သင်ဝင်ရောက်နိုင်သည် ။
ဥပမာ
var x = document.getElementById("myScript");
အကြံပြုချက်- scripts collection ကိုအသုံးပြုခြင်းဖြင့် <script> ဒြပ်စင်တစ်ခုကိုလည်း သင်ဝင်ရောက်နိုင်ပါသည် ။
Script Object တစ်ခုကို ဖန်တီးပါ။
document.createElement() နည်းလမ်းကို အသုံးပြု၍ <script> ဒြပ်စင်တစ်ခုကို ဖန်တီးနိုင်သည်-
ဥပမာ
var x = document.createElement("SCRIPT");
Script Object Properties
Property | Description |
---|---|
async | Sets or returns whether a script should be executed asynchronously as soon as it is available |
charset | Sets or returns the value of the charset attribute of a script |
crossOrigin | Sets or returns the the CORS settings of a script |
defer | Sets or returns whether a script should be executed when the page has finished parsing |
src | Sets or returns the value of the src attribute of a script |
text | Sets or returns the contents of all the text nodes that are children of a script |
type | Sets or returns the value of the type attribute of a script |
စံသတ်မှတ်ချက်များနှင့် အစီအစဉ်များ
Script object သည် စံ ဂုဏ်သတ္တိများ နှင့် ဖြစ်ရပ်များ ကို ပံ့ပိုး ပေးပါသည်။
ဆက်စပ်စာမျက်နှာများ
HTML ရည်ညွှန်း- HTML <script> တဂ်