You have already seen the mandatory Hello World program - so no need to repeat that here. From now one we will be concentrating one stuff inside the script tag. So when I say
I mean the full HTML file with the 'alert("Hello World")' text inside the script tag. But if you want to try the code in the T-Box, you just have to type alert("Hello World") and not the full HTML content.
Wondering how to write a the string to the HTML area in the window rather than pop up a message box? This code will do the trick.
Be careful with this. Put it after the the <body> tag like this...
If it is given before the body tag, a new page will be created with the 'Hello World' text. This will not work with the T-Box. T-Box will make a new page with the given text. Try it out if you must. Just click the 'Back' button to come back.
Before doing anything with this, I have to warn you that this is an old method - I will NOT recommended its use. If you have to write text into a page use innerHTML or other DOM functions.
Comment is what a programmer will enter into the source code to make the source more understandable. They are ignored by the interpreter. It is a good idea to explain what you are doing using comments - this makes the code more readable.
// - The Line Comment
/* */ - Block Comment
//This is a single line comment /* This is a block comment. This will comment out every thing from the beginning to the end */
Semi-colons are not a must but it can be used to separate multiple statements on the same line. It is recommended that you use ';' at the end of all lines.Example
blog comments powered by Disqus