1. (50 points) The textarea named ta1 shown to the left is in a form named f1. It contains contains the 2015 Top 100 billionaires (from here). For each person, the following data is shown:
Rank followed by a comma Name followed by a comma Citizenship followed by a comma Age followed by a comma Net Worth USD billion followed by a comma Source(s) of wealth followed by a semicolon (except for the last one) Write the javascript function named p1() that: 1. Retrieves the data from the textarea ta1 2.Creates a 100 row by 6 column table containing the data. [ Use NO column headings for the table ]. 3. Calculates the average age 4. Calculates the average net worth 5. Counts the number of billionaires from the US 6. Places the table and items 3→5 above in the DIV block with id="p1_out". CAUTION: some values of Age are shown as "n/a". Skip these ages in your calculations.
Show NO HTML. Show only the javascript for p1. |