|
1. (50 points) The textarea to the right is named ta1 is in a form named f1 The data contained in ta1 is the Top 100 US Newspapers. Three items of data for each newspaper is provided:
1. rank followed by a semicolon
2. newspaper name (city, state) followed by a semicolon
(NOTE: some state values are missing)
3. circulation followed by a question mark
(except the last one which does not have a "?" at the end)
Write the javascript function p1 that:
1. Retrieves the data from ta1.
2. Produces a 100 row by 4 column table that contains in the 4 columns:
1. rank
2. newspaper name
3. city state [be sure the parenthesis have been removed]
4. circulation
3. Assume there are two 14 element arrays:
var title_word = ["Chronicle","Daily","Dispatch","Enquirer","Gazette","Herald","Journal",
"News","Post","Press","Register","Sentinel","Times","Tribune"];
var tcount = [0,0,0,0,0,0,0,0,0,0,0,0,0,0];
4. Count the number of times each title_word appears in the 100 newspaper names.
Store the 14 counts in the array named tcount. DO NOT WRITE these two arrays. Assume there are in p1
5. Additionally follow the table with 14 lines each containing title_word and its count
6. Place the table and the title_words/counts in the DIV with id="p1_out"
Show only the javascript for p1.
this is the p1_out DIV
|