Java Script ආරම්භය.
Java Script ඉගෙනගනිමු.
අපි බලමු කොහොමද Java script වලින් යම් වාක්යයක්(Text එකක්) display කර ගන්නේ කියලා.
මේ සඳහා document.write() කියන method එක භාවිතා කරනවා.
උදාහරණයක් බලමු :-
<html>
</head>
<body>
<script type="text/javascript">
document.write("java script lesson")
</script>
</body>
</html>
මේක HTML Document එකක් විදියට save කරගෙන web browser එකක් හරහා Run කර බලන්න.
Java Script වල comment යෙදීම.
මෙහිදී comment යොදන ආකාර 2කි.
1.One line comment
මේ සඳහා // භාවිතා කරයි.
<script
document.write("My first JavaScript") // this is the comment
</script>
2.Multiple line comment
මේ සඳහා
/* This whole section is commented
out so it is not treated as a part of
the script. */
ලෙස ලිවිය හැකිය.
මීළඟ tutorial එක නැරඹීමට next මත click කරන්න.
0 comments:
Post a Comment