Hello World Example:
<html><head><title>Hello World</title></head> <body> <script> document.write("Hello, World!") </script> </body> </html>
Of course your script can not be interpreted by old browsers, such as Netscape 1.x, Internet Explorer 3.x and earlier, and the America Online browser before version 4. While well working browsers are told to ignore what they do not “understand”, we use a technique to make sure.
Script Listening 1.2:
<html><head><title>Hello World</title></head> <body> <script><!-- Hide Script document.write("Hello, World!") //End Hide Script--> </script> </body> </html>
The more advanced your scripts get, the more it becomes necessary for you to write comments inside your scripts. For example we could forget what a certain statement means and in order not to need to look it up in a book or here at HTMLcenter, you can write a comment next to it which explains what it does. If you distribute your scripts on your website, you could use comments to write a short notice, that tells who it was written by and where to find it, and other scripts.
Script Listening 1.3:
There are two different ways to write comments. You can use “/*” and “*/” if the comments are more than one single line, instead of writing “//” at the beginning of each. We use “//” if your comments fit on one single line.
Please note, that if any of the HTML tags, you have read while going over this tutorial confuse you, or you are not quite sure about their meaning, please check out our HTML tutorials (Basics) at HTMLcenter.