DISC 3371 Spring 2008 Parks Midterm Last Name_________________________________ Student Number ____________________

 

Upload My Video

 Video Filename:
 

 My E-mail Address:
 

 

1. (50 Points) A simple HTML form shown to the left requests information from a user in order to upload a file stored on the user's local hard drive. The page contains: (1) a form named f1; (2) a textbox named vid; (3) a textbox named email; and (4) a button with the label "Send My Video" that when clicked calls the vbscript sub named p1.

Write the VBScript code for p1 to edit the two user fields according to the following rules:

  1. vid field
    • The field must begin with the drive letters (c, d, e, f, g, h, i, j or k). This can be upper or lower case. The valid lower-case drive letters are stored as strings in an array named vd which has 9 elements with a beginning index of 0.
       
    • The field must end with one of the following filetypes: ".mov"; ".wmv"; ".avi"; ".flv"; or ".mpg". They can be upper or lower case. These valid lower-case video types are stored as strings in an array named vt which has 5 elements with a beginning index of 0.
  2. email field
    • must end with one of the following: "com"; ".net"; ".org"; ".edu"; ".int"; ".mil"; ".gov"; ".arpa"; ".biz"; ".aero"; ".name"; ".coop"; ".info"; ".pro"; or ".museum". They can be upper or lower case. The valid lower-case email suffixes are stored as strings in an array named ve which has 15 elements with a beginning index of 0.

 
 
  • Display an appropriate error message for any error encountered in editing the two fields and then exit the subroutine (Note: use the "exit sub" verb to do this). If no errors are encountered, display the message "All OK".
  • Note: Assume the arrays vd, vt and ve are defined in p1 -- so don't spend time writing them down. They are zero-based (i.e., the first element is located at array position zero). Remember VBScript strings, however, are indexed beginning at one.
  • Show ONLY the VBScript for p1.

BIG POUND SIGN

Cell size  

This is the div block with id="out2"
2. (50 points) The page shown to the left contains a form named f2; a textbox named cs; a DIV block with id="out2"; and a button labeled "GO" that when clicked executes the javascript function p2. Two gif files are available to this function named "bluex.gif" and "whitex.gif". Both bluex.gif and whitex.gif are 24 by 24 pixel gif files.

The function p2 then:

  1. Retrieves the value for cs.
  2. Creates a string named o2 that contains a two-pixel border HTML table with exactly seven rows and exactly five columns. The contents of the table cells are:
    • Rows 3 and 5 contain five cells EACH with a "bluex.gif" image whose width and height correspond to the value of cs.
    • Column cells 2 and 4 also contain a "bluex.gif" image with height and width equal to the value of cs.
    • All other cells contain the "whitex.gif" images with height and width equal to the value of cs.
  3. The resulting string's value (i.e., o2) is then assigned to the "innerHTML" property of the "out2" DIV block.
Show ONLY the javascript code for p2.