JavaScript_1


Comment ထည့္တယ္ဆိုတာ မွတ္သားလိုခ်င္တဲ့ ကုတ္ေတြ မွတ္မိေစလိုတဲ့ ကုတ္ေတြကို အင္တာနက္ browser မွာမေပၚေစပဲ ကုတ္ေရးသူအေနနဲ႔သာ
နာလည္ေစခ်င္တဲ့အခါသံုးတာပါ၊ HTML ကိုေလ့လာျပီးသူေတြအေနနဲ႔ Comment ကိုေကာင္းေကာင္းနားလည္မွာပါ၊ Comment ေတြကို browser ေတြက
ဘာသာ မျပန္ဘဲ ခ်န္ထား ခဲ့တယ္၊  ကုတ္ေရးသူအတြက္သာ ရွိေနမယ္ မွတ္သားစရာေတြကို Comment နဲ႔ မွတ္သားေတြ႔ရွိႏိုင္တယ္၊
JavaScript Comment ကိုေရးဖို႔အတြက္ // ဆိုတဲ့ ေရွ႕ကို ညြန္းထားတဲ့ မ်ဥ္းေစာင္းႏွစ္ခုကို သံုးတယ္၊ အဲ့ဒီ့ မ်ဥ္းေစာင္းႏွစ္ခုရဲ့ေနာက္က စာေတြမွန္သမွ်
browser က Comment အျဖစ္မွတ္ယူျပီး ဘာသာမျပန္ပဲထားခဲ့မယ္၊ ေအာက္မွာဥပမာကိုၾကည့္ပါ၊
<html>
<head> </head>
<body>
<script type=”text/javascript”>
//this is what we call the comment
Document.write(“finally someone let me out of my cage”);
</script>
</body>
</html>
အထက္က ကုတ္ကို html ရဲ့ head section ထဲမွာထည့္ျပီး run ၾကည့္ရင္ အေျဖအျဖစ္ finally someone let me out of my cage ဆိုတဲ့စာသားကို ပဲ အေျဖအျဖစ္ ထုတ္ေပးပါလိမ့္မယ္၊ this is what we call the comment ဆိုတဲ့ စာသားကိုေတာ့ ထုတ္ေပးမွာ မဟုတ္ဘူး၊ အေၾကာင္းကေတာ့ this is
what we call the comment ရဲ့ ေရွ႕မွာ // comment သေကၤသပါလို႔ browser က မွတ္ခ်က္အျဖင့္ယူစျပီး  ဘာသာမျပန္ပဲထားခဲ့တာပါ၊ ဒီေတာ့ // ကို
မွတ္ခ်က္ထားခ်င္တဲ့ စာသား အတြက္ အသံုးျပဳတဲ့ သေကၤသလို႔ သေဘာေပါက္ပါ၊
အထက္က လို စာေၾကာင္းတစ္ေၾကာင္းထဲ ထည့္ခ်င္ရင္ // သေကၤသ ပါတဲ့ forward slashes ႏွစ္ခုကိုသံုးတယ္၊ ဒါေပမယ့္ comment လိုင္းေတြအမ်ားၾကီးကို တစ္ျပိဳင္ထဲ ေရးခ်င္တယ္ဆိုရင္ေတာ့ အဖြင့္ /* နဲ႔ အပိတ္ */ တို႔ကိုသံုးႏိုင္ပါတယ္၊ သူတို႔ ႏွစ္ခု ၾကားထဲမွာ comment ေတြ႕ကိုၾကိဳက္သေလာက္ထည့္ႏိုင္ပါတယ္၊
<html>
<head> </head>
<body>
<script type=”text/javascript”>
/*this is what we call the comment
Hey this is second line of comment
Hi this is third line of comment
*/
Document.write(“finally someone let me out of my cage”);
</script>
</body>
</html>
အထက္က ဥပမာမွာ Comment အျဖစ္ထည့္ထားတာက  စာေၾကာင္းသံုးေၾကာင္းပါ၊  တကယ္ေတာ့ စာေၾကာင္းေတြအမ်ားၾကီးထည့္လို႔ရပါေသးတယ္၊
အခုေတာ့ ဥပမာ အေနနဲ႔ သံုးေၾကာင္းပဲ ထည့္ျပထားတာပါ၊ ဒီေတာ့ အဖြင့္ /* နဲ႔ အပိတ္ */ သေကၤသ တို႔ကိုသံုးျပီး comment ေတြအမ်ားၾကီးကို
တစ္ျပိဳင္ထဲ ထည့္လို႔ရတယ္ဆိုတာ မွတ္သားပါ၊  ဒီအခန္းမွာ ေတာ့ document.write( ); ကိုအသံုးျပဳပံုကို မ်ားမ်ား မရွင္းျပေသးဘူး၊ ဒါေပမယ့္
အၾကမ္းဖ်င္းအေနနဲ႔ ေတာ့ သူက  သင့္ရဲ့ Program ကိုေရးျပီး ၀က္ဆိုက္မ်က္ႏွာျပင္ေပၚမွာ ေပၚေစမယ့္ စာသားကိုေပၚေအာင္လုပ္ေပးတဲ့အခါမွာသံုးတယ္၊
document.write ရဲ့ေနာက္က ဂြင္းစ ဂြင္းပိတ္ထဲမွာ သင္၀က္ဆိုက္စာမ်က္ႏွာမွာေပၚေစလိုတဲ့ စာသားေတြကို ေရးေပးရတယ္၊
ေအာက္မွာ ေနာက္ထပ္ထပ္ရွင္းျပမယ္၊  Program တစ္ခု အလုပ္လုပ္တယ္ဆိုတာက ၾကိဳတင္စီစဥ္ထားတဲ့အစီအစဥ္ အစိတ္အပိုင္း တစ္ခု စီကို အစကေန
အဆံုး အထိ ျပီးေအာင္ တစ္ခုစီလုပ္သြားတာ၊ ေအာက္က ဥပမာ ကိုၾကည့္ပါ၊
<html>
<head> </head>
<body>
<script type=”text/javascript”>
Document.write(“finally someone let me out of my cage”);
Document.write(“Now time for me is nothing cause I counting no age”);
Document.write(“ I culdn’t be there, You shouldn’t be scare”);
</script>
</body>
</html>
အထက္က ကုတ္ကို Run ၾကည့္လိုက္ရင္ေတာ့ finally someone let me out of my cage, now time for me is nothig cause I counting no age,
I couldn’t b there, you shouldn’t scare; ဆိုတဲ့စာသားကို အေျဖ အျဖင့္ သင့္ကြန္ျပဴတာရဲ့ browser မွာ ထုတ္ေပးမွာပါ၊
ကုတ္ကို ေသခ်ာေလ့လာၾကည့္ရင္ ပထမ         ၊ Document.write(“finally someone let me out of my cage”) ဆိုတဲ့ စာသားကို အရင္ ဆံုး
အေျဖထုတ္ခိုင္းတယ္၊ သူ႔ေနာက္က
Document.write(“Now time for me is nothing cause I counting no age”); ဆိုတဲ့စာသားကို ဒုတိ ယ အေနနဲ႔ အေျဖထုတ္ေပးမွာပါ၊
Document.write(“I couldn’t be ther , You shouldn’t scare”); ဆုိတဲ့ အျဖကို တတိယ အေနနဲ အေျဖထုတ္ေပးမယ္၊ ဒီလို ပထမ ဒုတိယ တတိယ
ဆိုျပီး တဆင့္စီ ေရးထားတဲ့ကုတ္ေတြက တစ္ခုျပီး တစ္ခု အလုပ္လုပ္မွာပါ၊  ဒါကေတာ့ Programme ရဲ့ တစ္ဆင့္စီအလုပ္လုပ္တဲံ ပံုစံဥပမာပါ၊

0 comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...

တြက္ခ်က္ပါ






powered by calculator.net

ေငြအတြက္မပူပါနဲ့

ခ်က္ၾကမယ္ေလ


Try Relay: the free SMS and picture text app for iPhone.