Assignment 5
Due Thursday, 4/16 at the start of class
You are to create two JavaScripts, 2 PERL scripts, and a page with links
to all of them. Hand in a printout of all the scripts. Send me an e-mail
message of where to locate the page with the links.
JavaScripts
-
Create a JavaScript function that will create a new, random window based
on the time. The contents of the window should be generated in the script.
Activate the function by using a "button" type in a form in your original
HTML page. Use the Date class, and the member function getSeconds( ) to get
the current number of seconds. Then do the % 3 trick to get a number from
0 .. 2. Depending on this number, generate a NEW window, do not overwrite
the current document. Change the following in the new window
-
width and height. These control the size fo the new window.
-
screenX and ScreenY. These control the location of the new window.
-
Background color and text color for the new document
-
Contents of the new document
-
Have the new window self-destruct in 2 seconds.
-
Create a JavaScript page that will display a form. You only need to have
three text fields in the form, and a submit button. All the text fields must
be filled in. The JavaScript will check that all the fields are filled in
before submitting the form. If they are not, then set the focus to the first
missing field. Submit the contents of the form to the PERL script below,
save.cgi. Add several records to the file.
PERL Scripts
-
Create a PERL script named save.cgi that will save its paramters to
a data file. You decide the format for saving the data to the file. Be sure
that the file only has rw permission by you. Run the script through cgiwrap.
-
Create a PERL script named retrieve.cgi that will open the data file
you created above and display all the data in a nice, readable format. It
should be clear in your output where one record ends and the next begins.
Run the script through cgiwrap
Extra Credit of 4 points
For the form script, use the cookie to make the form "super sticky". The
user should be able to quit the browser, reopen the browser, reopen the page
and still see the data in the form, for up to 5 minutes. Only create one
cookie with the data from all the fields.