JavaScript Practice Exercises

Last Updated: 21 February 2006

Update 21 February 2006:
JavaScript has changed! The old style of coding is out out out! The DOM (Document Object Model) is in! AJAX is in! This page will not longer be updated. I'm gonna start working on AJAX-y exercises to try to get up to speed. Check it out!


Note:
Some of these examples got broken in the website re-org Feb/2002. I'll have to get around to fixing them someday, but not today! MicroSoft FrontPage messes up JavaScript code; if I editted the member using FrontPage instead of BBEdit, I might have corrupted the code. I need to retrieve an old version of the broken pages from a website backup to see if that has good JavaScript. Also, the examples where program code appears in the text entry box might be a problem with a JavaScript incompatibility - I noticed the same problem using IE to use other people's pages with

These are exercises that I did to practice while learning JavaScript. I pretty much copied, and sometimes modified examples right of Dori Smith's and Tom Negrino's book "JavaScript for the World Wide Web". I found this book to be a quite excellent introduction to JavaScript because it is simple to understand, yet every single example is immediately applicable to something that you might want to do yourself on the web. The book is small, so it's not intimidating or difficult to use like most of the bigger books and it's much cheaper (list $17.95 US). I still come back to these exercises to copy code that I actually use on my webpage.

In April 2001, I came back to pick up some more JavaScript. The "JavaScript Bible (3rd Edition)" by Danny Goodman was helpful. Some of the stuff below are exercises that either came directly from, or were based on or inspired by exercises from this book.

  1. My first JavaScript: "document.write"
  2. My second JavaScript: "alert"
  3. Loop: Count and List Navigator Plug-Ins
  4. Display "Alert" Window
  5. Scrolling Status Bar (Pesky Thing!)
  6. Display Status Bar Message When Rolling Over Links (should display text on bottom of the browser window instead of the URL???)
  7. Rollover Button (Bad Technique)
  8. Rollover Button (Better Technique)
  9. Change Image as you Roll Over Links
  10. Rotate through animated GIFs
  11. Rotate through JPGs. Wait for each image to load.
  12. Baking My First Cookie (looks like program text in the entry box???)
  13. No exercise. 13 is unlucky!
  14. Reading a Cookie
  15. Using Cookies as Counters (doesn't seem to DO anything???)
  16. Deleting Cookies
  17. Date Calculations (hard-coded start date doesn't match what displays???)
  18. Date Calculations With Data Entered by User
  19. Date Calculations With More Data Entered by User (looks like program text in the entry box???)
  20. What Information is available from my browser? (work in progress)
  21. JavaScript Exercise (placeholder)
  22. JavaScript Exercise (placeholder)
  23. JavaScript Exercise (placeholder)
  24. JavaScript Exercise (placeholder)
  25. JavaScript Exercise (placeholder)

I did some goofing around with Microsoft FrontPage. Here's some Form Fields stuff that I tried and now I want to see what it looks like.


Back to JavaScript Exercises

Comments | Doug and Kris' Home Page | Kris' Page | Doug's Page | Site Map