For coding answers, click "View", then "Source" -- click the buttons below to see the code execute
Texians
at the Battle of San Jacinto
April 21, 1836 |
1. (50 points) The textarea (named sanjac) shown
to the left is in a form named f1 that contains the names of the
870 known soldiers at the Battle of San Jacinto fought in
what is now Harris County, Texas on April 21, 1836 (Note: many names have
been omitted in the display to the left -- but there are 870 soldiers
listed in the actual textarea used in the code). For each soldier there
are four pieces of data separated by commas. The format of the data in the
textarea is:
So, each soldier has 4 fields: last name; first name (and maybe an initial); rank (or maybe nothing); W or K or nothing; each followed by a comma. Produce a report "on-the-fly" with the following three items:
Data from: http://freepages.genealogy.rootsweb.ancestry.com/~genbel/states/texas/battleofsanjacinto.html |
Below is this DIV block with id="p2_out":
|
2. (50 points) Two textboxes shown to the left each
contain a single numeric digit. They are in a form named f2. The
first textbox is named nr and is to be used to define the number
of rows in a table you are to produce. The second textbox is named
nc and is to be used to define the number of columns in the
table you are to produce. When the button labelled "Execute p2" is
clicked, a javascript function named p2 is executed. Assume that
the function p2 has these statements (bold-faced below) at the
beginning (don't waste time writing them down):
Note: the final table displayed in p2_out will actually have (nr+1) rows and (nc+1) columns. Show NO HTML. Show ONLY the javascript code for the function named p2. |