Wednesday 14 May 2014

First Basic Program Using Javascript.

In this post you know about how we can write the simple program using javascript.


Program for printing "Hello Amit"


<html>
<body>
<script language="javascript" type="text/javascript">
<!--
   document.write("Hello Amit!")
//-->
</script>
</body>
</html>

We added an optional HTML comment that surrounds our Javascript code. This is to save our code from a browser that does not support Javascript. The comment ends with a "//-->". Here "//" signifies a comment in Javascript, so we add that to prevent a browser from reading the end of the HTML comment in as a piece of Javascript code.

Next, we call a function document.write which writes a string into our HTML document. This function can be used to write text, HTML, or both. So above code will display following result:

I am using dreamweaver so the code should be look like below image,



















Output is,








Just follow the above instruction an you are now able to write your code by own its easy just try once.if you are facing any doubt so ask freely i ll help you.Thanks

No comments:

Post a Comment