CIS89C: Client-Side Programming with JavaScript

Week 3

Assignment 3


Functions and Objects


Due Date: Week 4 Day 1
50 points (Layout: 10, Content: 40)

DO NOT USE ANYTHING THAT WE HAVE NOT LEARNED YET. THE LESSONS STOP AT WEEK 3. We want to learn step by step, i.e. be able to use what we have learned during Weeks 1, 2, and 3.

Think along the line of your business, hobbies, or personal Web site.

Now you go a step further in creating interactivity with the user.

Create a product information link (You'll get a chance to create the Products page in another assignment). With the product information page (or something similar to that depending on the theme of your site), you create the script consisting of objects, functions and variables to do the following:

  • Create an object that has:
    • 2 properties: image and description
    • a method to display the image and the description
  • Create function1: make an instance of the object with an image and description and display the properties.
  • Create function2: make an instance of the object with another image and description and display the properties.
  • Create function3... functionN, depending on how many products you want to have for the users to see. Have at least 2 products, thus 2 functions.
  • Create selectProduct to do the following:
    • A dialog box is displayed asking the user to enter his/her first name. Use a variable to store it. Then another dialog box is displayed asking the user to enter his/her last name. Use another variable to store it.
    • Once the user inputs the data, an alert is popping up displaying any wording you want with the first and last names of the user.
    • Using the same variable (not a new one, it can be either one used for the first or last name, this is to show that a variable can be reused), open another dialog box asking the user to enter a selection between several items (use your creativity to either show the 2 items for the user to type in (e.g. item1, item2, item3, etc.) or (e.g. 1, 2, 3, etc.).
    • After the user enters his/her answer (item1 or item2, or etc., or 1 or 2, etc.), use conditionals to do the following:
      • if item1 or 1: call function1.
      • if item2 or 2: call function2.
      • if item3 or 3: call function3, etc. depending on how many items.
      • if incorrect or no item found, display a message saying so.
  • By clicking on the Product Information link, load selectProduct.

Make sure to have at least 2 products to display the images and descriptions.

Make sure to read the requirements very carefully. Once your lab is submitted, it's not allowed for you to redo it. I do not regrade. One day late is 10% off. A perfect assignment with more than 2 weeks late will get a maximum of 10% only.

Email me in the format shown below to inform me that your lab is ready to be graded. I highly suggest you send yourself a courtesy copy (cc).

{Your name}
{Your Voyager account name (e.g. xyz36459}
{Class: CIS89C}
{Assignment #3}

I cannot grade if I don't receive your email.