This is the DIV with id="p1out"
| 1. (50 points) The Top 100 Downloaded Files from www.freewarefiles.com are shown to the left in a form named f1 in a textarea named ta1. For each of the 100 software downloads, the following data is shown:
1. rank (from 1 → 100) followed by a "*" 2. software title followed by a "*" 3. description followed by a "*" 4. downloads followed by a "$" (except the last one which does NOT end with a "$") The following two arrays are defined in p1 (Do NOT write these statement): ms = [ "Windows" , "Microsoft" , "Internet Explorer" , "MSN" ]; msc = [ 0 , 0 , 0 , 0 ]; Use these two arrays to search the text in column 2 and column 3. Test each field (i.e., column 2 and column 3) for the occurrence of each of the four search words in the array named ms. Count ONLY the first occurrence of each of the four search words in each cell. Use the array named msc to store the counts. NOTE: you must convert both the data AND the search terms to uppercase before making the test. Your output should be in three parts: 1. Create a 100 row, 4 column table that contains:
When completed, place: (1) the 100 row 4 column table; (2) the average download count; and (3) the search words and counts table in the DIV block with id="p1out". When the user clicks the "Execute p1" button, the javascript function named "p1" is executed. Show NO HTML. Do NOT write a table heading row at the top of either table in the answer. Write only the javascript for the function p1. |
This is the SPAN block with id="p2out"
| 2. (50 points) Whether a number is odd or even in javascript can be accomplished by using modular arithmetic. The modulus operator % is used to divide a number by another number and assign the integer remainder. A special case occurs when the second number is two. It allows us to decide whether of not the first number is odd or even by dividing the number by two and retaining the remainder. If the number is even the remainder will be 0. If the number is odd the remainder will be 1.
Suppose: temp = x % 2;
Consider the textbox named n in a form named f2 shown on the left. You are to write the javascript function named p2() that:
|