Section 1: Basics

Javascript is a language designed to really "spice up" your websites! Javascript instructions are inserted into the document via the <SCRIPT> tag. See the example below:


<H1>Welcome to Javascript

  document.write("</h1> <b>It's lots of fun!</b>");

<p> Thanks for coming! </p>


Follow this link to see this example in action.

Here, in between the opening <SCRIPT> and the closing </SCRIPT>, we meet our first Javascript command, document.write("</h1> <b>It's lots of fun!</b>");

This is one of the most useful Javascript commands - it puts HTML and text onto the page. The text (or HTML) to go onto the page is put in "quotes", and then the quoted text is put in between the brackets of the document.write( ); command.

For example

  document.write("<b>This is my text</b>");

Would output

This is my text

to the screen.