|
|
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:
- 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.
- 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.
|