HTML အကိုးအကား

အက္ခရာဖြင့် HTML HTML အမျိုးအစားအလိုက် HTML Browser ပံ့ပိုးမှု HTML အရည်အချင်းများ HTML ကမ္ဘာလုံးဆိုင်ရာ အရည်အချင်းများ HTML ပွဲများ HTML အရောင်များ HTML Canvas HTML အသံ/ဗီဒီယို HTML အက္ခရာအစုံများ HTML Doctypes HTML URL ကုဒ် HTML ဘာသာစကားကုဒ်များ HTML နိုင်ငံကုဒ်များ HTTP မက်ဆေ့ခ်ျများ HTTP နည်းလမ်းများ PX မှ EM Converter ကီးဘုတ်ဖြတ်လမ်းများ


HTML onload Attribute


အဓိပ္ပါယ်နှင့် အသုံးပြုမှု

အရာတစ်ခုကို တင်လိုက်သောအခါတွင် onload attribute သည် မီးလောင်ပါသည်။

ဝဘ်စာမျက်နှာတစ်ခုသည် အကြောင်းအရာအားလုံးကို (ရုပ်ပုံများ၊ ဇာတ်ညွှန်းဖိုင်များ၊ CSS ဖိုင်များစသည်ဖြင့်) အပါအဝင် ဝဘ်စာမျက်နှာတစ်ခုမှ အပြည့်အ၀တင်ပြီးသည်နှင့် script ကိုလုပ်ဆောင်ရန် onload ကို <body> ဒြပ်စင်အတွင်းတွင် အများဆုံးအသုံးပြုလေ့ရှိသည်။ သို့ရာတွင်၊ ၎င်းကို အခြားဒြပ်စင်များပေါ်တွင်လည်း သုံးနိုင်သည် (အောက်ပါ "Supported HTML tags" ကိုကြည့်ပါ)။

ထည့်သွင်းသည့်ဒြပ်စင်များအတွက်၊ <input type="image"> တွင်သာ onload attribute ကို ပံ့ပိုးပေးပါသည်။

လည်ပတ်သူ၏ဘရောက်ဆာအမျိုးအစားနှင့် ဘရောက်ဆာဗားရှင်းကို စစ်ဆေးရန်နှင့် အချက်အလက်ပေါ်အခြေခံ၍ ဝဘ်စာမျက်နှာ၏ သင့်လျော်သောဗားရှင်းကို တင်ရန် onload attribute ကို အသုံးပြုနိုင်သည်။


တွေပေါ့။

onload attribute သည် Event Attributes ၏ တစ်စိတ်တစ်ပိုင်းဖြစ်ပြီး အောက်ပါဒြပ်စင်များတွင် အသုံးပြုနိုင်ပါသည်။

ဒြပ်စင်
<body>
<iframe>
<img>
<input>
<link>
<script>
<style>

ဥပမာများ

ခန္ဓာကိုယ်ဥပမာ

စာမျက်နှာတစ်ခုကို တင်ပြီးသည်နှင့် ချက်ချင်း JavaScript ကို လုပ်ဆောင်ပါ-

<body onload="myFunction()">

Img ဥပမာ

<img> ဒြပ်စင်ပေါ်တွင် onload ကိုအသုံးပြုခြင်း။ ပုံတစ်ခုတင်ပြီးသည်နှင့် "Image is loaded" ဟု သတိပေးချက်-

<img src="w3html.gif" onload="loadImage()" width="100" height="132">

<script>
function loadImage() {
    alert("Image is loaded");
}
</script>

ထည့်သွင်းဥပမာ

<input type="image">ဒြပ်တစ်ခုပေါ်တွင် onload ကိုအသုံးပြုခြင်း။ ပုံတစ်ခုတင်ပြီးသည်နှင့် "Image is loaded" ဟု သတိပေးချက်-

<input type="image" onload="loadImage()" src="img_submit.gif" alt="Submit">

<script>
function loadImage() {
    alert("Image is loaded");
}
</script>

Browser ပံ့ပိုးမှု

onloadရည်ညွှန်းချက်တွင် ဒြပ်စင်တစ်ခုစီအတွက် အောက်ပါဘရောက်ဆာ ပံ့ပိုးမှုပါရှိသည်

Element
body Yes Yes Yes Yes Yes
iframe Yes Yes Yes Yes Yes
img Yes Yes Yes Yes Yes
input type="image" Yes Yes Yes Yes Yes
link Yes Yes Yes Yes Yes
script Yes Yes Yes Yes Yes
style Yes Yes Yes Yes Yes