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:

<HTML>
<BODY>

<H1>Welcome to Javascript

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

<p> Thanks for coming! </p>

</BODY>
</HTML>

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

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

Would output

This is my text

to the screen.