cmpt165
Spring 2007
CMPT 165-D2 @ Surrey: Lab 9
The objective of this lab is to continue familiarizing yourself with JavaScript programming, and adding JavaScript to your XHTML pages.
-
Begin this lab by downloading this XHTML file. This file contains the necessary tags to load in your JavaScript file. Make sure you recognize and understand what they are.
Modify this page so that it contains a form that asks the user for a password. You can use a text input for the password, or try type="password" for the <input> tag and see what happens (it works the same as a text input as far as your Javascript code is concerned).
The response when the form is submitted should depend on whether or not the password is correct. If the password entered is “cmpt165”, you should respond with a secret message (of your choosing).
If the user enters anything else for the password, they should be given an error message:
-
We've covered a lot of content this semester, and you might feel that you have not had enough time to try everything. For the remainder of this lab, use your time to practice some of the other Javascript techniques that we have learned this semester. For example, you may wish to implement and understand the timer script we wrote for lecture 11 (slides 25-27), or experiment with returning information about the browser. The Javascript lectures are all available in WebCT, in files lec9.pdf through to lec17.pdf. Now is a good time to figure out where you are having problems, and start thinking about the final exam!
-
When you're done, show your latest XHTML and JavaScript files to your lab TA, and what they do.
Please note that you are expected to keep a copy of the work that you have done. You can keep a record on the student server (SIAT), a portable hard drive (e.g. key drive), or simply by email the URL you have created to yourself.