JavaScript - The Real Basics....

Script Tags

The <script> tags are HTML -- they tell the browser that what follows will be scripting code, not HTML.

JavaScript Comments

To comment out a line in JS you would use the double slash //. For multiple line comments you can use the slash-star pair as such: /* here is my comment */

The Variables

      var str1, str2, str3;       //declaration of 3 variables named st
      str1="<b>Hello World</b>";  //assigning a "string" to the variable
      str2="<b>Goodbye World</b>";//assigning a "string" to the variable
      str3="<b>The End</b>";      //assigning a "string" to the variable

Document.write()

Text within the main <body> tag will display AFTER any scripts above it in the <head>

Reassigning the Variables

      var str4 = str1;         //create a new variable, assign th value of str
      str1 = "This is " + str3; //change the value of str1
      str3 = str2;             //assigning the value of str2 to str3
      str2 = str4;             //assigning the value of str4 to str2

Tips and Tricks

Try removing quotes, variables and semi-colons. What kind of error messages do you receive?

Things to remember are include the <br> tag in your string if you want to break to the the next line. And of course, check your typing carefully!