Chris Pollett > Old Classes > PIC40 ( Print View ) Lecture Notes-PDF Spring '01 Ad: Enrollment info Course Info:
Practice Exams: PIC: |
HW#6 --- last modified January 16 2019 00:35:22..Due date: noon Mar. 14 ========= Files to be submitted: p40hw6file1.php ====================== p40hw6file2.gif -- first car rental image p40hw6file3.gif -- second car rental image HW6 Purpose: To gain some experience programming in javascript ============ by making the HW5 program do form verification and handle click, select, and mouse events. Specification: ============== Get the solution to HW5 off the HW5 page after its due date or use your own solution. On the intro page's form add an onSubmit attribute which calls the Javascript function VerifyDate() when this form is submitted. This function makes sure the departure date is of the form YYYY-MM-DD where the Y's are the digits of the year, the M's are the month (must be between 1-12) and the day is a value that works for that month. For instance 2001-02-29 does not work since February has 28 days. (you don't have to worry about leap years). If the date is incorrect, your program should pop-up an alert telling the user the date in incorrect and then saying the correct format. In this case, your function returns false. Otherwise, it returns true. In addition to the above, you will also modify what the HW5 program does after saving an itinerary. Instead of returning to the intro page. It draws a new page (this parts written in PHP) with Itinerary Saved in blue at the top. This is followed by an h1 heading which says, "Now that you've chosen your trip may we suggest the following hotels..." It then produces a selection gadget with four hotels for the city they are going to in their itinerary. Do a search on the web (by hand) to find links to hotels for each of the four cities Halifax, Boston, Los Angeles, and Paris stored in the database. Your selection gadget should use the onChange attribute to run a Javascript function GoToURL() which you write to go to the URL selected as soon as it is chosen. After the selection gadget, the page should then have an image link to a car rental company for that city. This image (p40hw6file2.gif) should be a picture of a car with the words Click for Wheels underneath it. If the link receives a mouseover event a Javascript function ChangeImage() should be called which replaces the image with a similar image (p40hw6file3.gif) where the colors have been slightly changed. On a mouseout event the original image is returned by calling ChangeImage() again. Note although the link will point to a different location depending on the city, you will only use these two images for all cities. Finally this page should have a submit button with value Return to Main Page which when clicked returns the user to the main page. Point Breakdown for HW6 ======================= VerifyDate only accepts correct dates..1pt alert pops up correctly if Date wrong..1pt After clicking Save Itinerary new page appears.........................1pt Selection gadget on new page appears as described..........................1pt onselect works as described............1pt Image link point to different locations for four cities in database..........1pt Mouseover and mouseout events handled correctly............................1pt Return to Main Page button works.......1pt Total..................................8pts |