JavaScript Exercises 2

Timers, Images, Sniffing and Validation

This simple tutorial covers some hugely important apects of Web programming. Do not underestimate the complexity or significance of the questions asked here!

  1. Create an HTML form and experiment with form validation. You can submit your forms to this this PHP script to see what arrives back on the server. Either copy this fully qualified URL into your form element;
    action="~doc/web/PHP/GPC.php" or install the source code for GPC.php onto your server
  2. Change mailingList.html to improve the data input validation. Research the use of the string object and its associated methods (e.g. indexOf(), lastIndexOf(), substring()). Try to validate the email address so that it contains a @ somewhere within it (i.e. not as the first or last character).
  3. This lecture has discussed the important issue of browser compatibility problems and browser sniffing. It has also briefly looked at client-side versus server-side programming.
  4. The page tut2-1.html sets the background colour to a new random colour that it generates each time it is loaded.
  5. tut2-2.html will display a blue rectangle made up of 80 separate square blue images arranged in 8 rows each of 10 images. As the user moves the mouse over the images in the rectangle they will flip to display a white image.
  6. Try to understand prairieDog.html.

best viewed using Mozilla browsers
© k.mcmanus 2004
Valid XHTML 1.1!. Valid CSS. WCAG priority 3 approved