CAUTION #1: Problem #2 requires some extra time to execute. The browser may ask you if you wish to stop running the script -- its OK to continue (i.e., the question will be "Stop running this script?" The answer is NO). It has to read the book ten times! It will finish OK.
CAUTION #2: If you print the entire source, remember you are printing a book -- so buy some more paper.
this is DIV block with id="dv1"
this is DIV block with id="dv2"
|
1. (50 points) At the left are two textareas, the first named t1 and the second named t2. Both appear in a form named tform. Both contain a string of words separated by commas. When the button labelled "GO" is clicked, a vbscript sub named p1 is executed. The p1 code should:
|
2. (50 points) Shown to the left is a textarea named Lewis that is in a form named Carroll. In the textarea is the entire text of Lewis Carroll's 1865 book "Alice's Adventures in Wonderland" (the text is from the Gutenburg Project). This textbox contains 147,738 bytes. There is a button labelled "GO" that when clicked executes a javscript function named p2. This function contains two 10 element arrays: (1) w; and (2) c. The array w is initialized as shown below (do not write the code shown in the box below on your exam -- just assume it is in the function).
var w = new Array (10); var c = new Array (10); w[0]="Alice"; w[1]="White Rabbit"; w[2]="Hatter"; w[3]="Queen of Hearts"; w[4]="March Hare"; w[5]="Drink Me"; w[6]="Caterpillar"; w[7]="Dormouse"; w[8]="Mock Turtle"; w[9]="Cheshire Cat";
This is the DIV with id="alice_out"
Note 1: Be sure to convert ALL the strings to uppercase (or lowercase) before comparing. Note 2: Use substr to extract the substrings of the book to examine. Show NO HTML. Show only the javascript for p2. |