DISC 3371 Fall 2008 Parks Midterm

1. (50 points) Below on the left is: (1) a textbox named ta; (2) the textbox is in a form named f1 and (3) a button labelled "go" that when clicked executes a vbscript sub named p1. On the right is a DIV block with id=tout that is initially empty.

 

This is the initial contents of the div block with id=tout
The textbox allows a professor to calculate grade averages by semester (Fall, Spring, Summer) for all the students by dropping formatted data into the textbox and clicking the "go" button. The data is formatted so that each row has: a student's name and their three GPA values for the three semesters. Each value is separated by a comma and a semicolon separates each student. Write the sub p1 that when executed:
NICE STRIPES 2. (50 points) The table to the left contains radio buttons and textboxes that allow a user to create various striped patterns. A pattern contains:
  1. nine (9) stripes chosen from any of five (5) colors: white; blue; black; red; and green.
  2. the width of each stripe is determined by the value in the textbox in the "Width" column.
  3. five one pixel by one pixel colored gif files are available:
    (1) white1x1.gif; (2) blue1x1.gif; (3) black1x1.gif; (4) red1x1.gif; and (5) green1x1.gif.
  4. the HTML objects to the left are contained in a form named f2.
  5. assume this array is available in p2():
    iname = new Array (5);
    iname[0]="white1x1.gif";
    iname[1]="blue1x1.gif";
    iname[2]="black1x1.gif";
    iname[3]="red1x1.gif";
    iname[4]="green1x1.gif";
Stripe 1 2 3 4 5 6 7 8 9
White
Blue
Black
Red
Green
Width
When the "go" button is clicked, a javascript function named p2() is executed. This function creates a new page "on-the-fly" that:
  1. creates a string named s that specifies nine gif files whose src attributes correspond to the color choice in the nine columns above (i.e., as shown above: the first column radio button chosen specifies the color "White", so the first gif file used is <img src='white1x1.gif'>; the second gif file would be: <img src="red1x1.gif">;... etc.
  2. a width attributes is included for each image that corresponds to the "Width" field in each column above.
  3. a height attribute is included for each image that is always '500'.
  4. displays the string s four times centered on the new HTML page
Show NO HTML. Show ONLY the javascript for p2().