HTML DOM Option Object
ရွေးချယ်စရာ အရာဝတ္ထု
Option object သည် HTML <option> element ကို ကိုယ်စားပြုသည်။
Option Object ကိုဝင်ရောက်ပါ။
getElementById() ကို အသုံးပြု၍ <option> ဒြပ်စင်တစ်ခုကို သင်ဝင်ရောက်နိုင်သည် ။
ဥပမာ
var x = document.getElementById("myOption");
အကြံပြုချက်- ပုံစံ တစ်ခု၏ ဒြပ်စင်များ စုစည်းမှု သို့မဟုတ် drop-down list ၏ ရွေးချယ်စရာများ စုစည်းမှု မှတဆင့် ရှာဖွေခြင်းဖြင့် ရွေးချယ်စရာ အရာဝတ္ထုတစ်ခုကိုလည်း ဝင်ရောက်ကြည့်ရှု နိုင်ပါသည်။
Option Object တစ်ခုဖန်တီးပါ။
document.createElement() နည်းလမ်းကို အသုံးပြု၍ <option> element တစ်ခုကို ဖန်တီးနိုင်သည်-
ဥပမာ
var x = document.createElement("OPTION");
Option Object Properties
Property | Description |
---|---|
defaultSelected | Returns the default value of the selected attribute |
disabled | Sets or returns whether an option is disabled, or not |
form | Returns a reference to the form that contains the option |
index | Sets or returns the index position of an option in a drop-down list |
label | Sets or returns the value of the label attribute of an option in a drop-down list |
selected | Sets or returns the selected state of an option |
text | Sets or returns the text of an option |
value | Sets or returns the value of an option to be sent to the server |
စံသတ်မှတ်ချက်များနှင့် အစီအစဉ်များ
Option object သည် စံ ဂုဏ်သတ္တိများ နှင့် အဖြစ်အပျက်များ ကို ပံ့ပိုး ပေးပါသည်။
ဆက်စပ်စာမျက်နှာများ
HTML ရည်ညွှန်း- HTML <option> တဂ်