Assignment #1:

Copy the script from this page and alter it so that two lines of text are produced, one red and one blue. Do not add more HTML to the instance. Just add more JavaScript commands. Make two bits of text write to two different lines rather than simply following each other on the same line.

HTML file: Displayed by browser:
<BODY>

<SCRIPT LANGUAGE="javascript">
document.write("<FONT COLOR='RED'>This Is Red Text</FONT>")
document.write("<BR /><FONT COLOR='BLUE'>This Is Blue Text</FONT>")
</SCRIPT>

</BODY>

What I have learned:

  1. The writeln does not work at all.
  2. Everything in parentheses must also be inside quotation marks. At first, I put the BR in front of the quotation mark on the BLUE line, which returned absolutely nothing. It took me a while to realize it was supposed to be inside the quotation marks.
  3. The assigned answer had the BR at the end of the RED line, which gives the same result as what I did.
  4. I don't get any popup error alert windows, although the displayed results sometimes help to realize there's an error. It's been 16 years since this book was published, and obviously, error messages are handled differently now.

BackTable of ContentsNext