<Script language="JavaScript> </Script>
Even though every JavaScript begins and ends with HTML tags, it is nothing like HTML. You can store variables, work with input and output, and overall just make your page more interesting and useful. Here is an example program written in JavaScript:
<Script language="JavaScript"> alert("Hello"); </Script>
This will make a small box appear which has "Hello" written on it. alert() is the JavaScript function which will create the actual box, the text in quotation marks is what will be displayed. Remember, if you want to include some text in JavaScript it must be written bewteen quotation marks. Another thing you must never forget is that pretty much every command you write in JavaScript must end with a semicolon (;).
Here is another example using variables this time:
<Script language="JavaScript"> var text= "Hello"; alert(text); </Script>
Here var is used to create a variable called text in which we store "Hello". See how in between the alert parenthesis I didn't add any quotation marks? Thats because I want it to display what I stored in the variable text, I don't actually want it to write out text. An important thing to remember while making variables is that text goes in quotation marks, but numbers do not. If you put a number in quotation marks you won't be able to use them to add, subtract, nor anything else you might want your numbers to do. Heres an example using numbers:
<Script language="JavaScript"> var number= 3; var number2= 4; alert(number+number2); </Script>
This will show whatever the value of number and number2 add up to which in this case would be 7. Here is another example with numbers:
<Script language="JavaScript"> var number= 3; var number2= 4; ++number; alert(number+number2); </Script>
The two plus signs infront of number tell the computer to add 1 to number making its value 3+1 or 4, so this will diplay 8.