Lab 5—Your First JavaScripts

Part 1—Fix a simple script


In this page, you will download a Web page and fix the script. Use the Firefox Error Console if you get stuck!

  1. Download purple_cow_fixit_script.html and the purple cow image.
  2. Save both files to your lab05 folder.
  3. Open it with NotePad++.
  4. Find the errors in the script using the hints at the side. You can find the errors with simple proofreading or using the Firefox Error Console.

    When it works, an alert will pop up asking if you like poetry, If you click OK, four more alerts will each display a line from the poem. If you click Cancel, one more alert will pop up.

 

Next you will set up a simple numbered list, otherwise known as an array....

previous page   next page

 

Pssst! Read these Hints!
Purple Calf
Some JavaScript Errors

  • Missing start or end quotes
  • Mismatched start and end quotes
  • Missing statement terminator (;)
  • Missing () after function name
  • Missing start or end paren: ( or )

Simple proofreading will find these syntax errors.