Last Name, First Name _____________________________________________________ Last 4 digits of PSID _____________
1. (50 points) The textarea shown to the left contains data on awards given to company employees each of the past twenty years. The DTD for the data is shown below.
<?xml version="1.0"?> <!DOCTYPE companyAwards [ <!ELEMENT companyAwards(year+)> <!ELEMENT year (yearValue,employeeName+)> <!ELEMENT yearValue (#PCDATA)> <!ELEMENT employeeName (#PCDATA)> <]>When the "Execute p1" button is clicked:
The number of years for the outer loop is: root.childNodes.length The yearValue is: root.childNodes[i].childNodes[0].childNodes[0].nodeValue The employee loop is: for (j=1;j<root.childNodes[i].childNodes.length;j++) The employeeName is: root.childNodes[i].childNodes[j].childNodes[0].nodeValue Provide NO table heading row. Assume the code to load the XML data from the textarea into root object in javascript has already been written. (Don't write this code. just start using root). Show no HTML. Show only the javascript for p1. This is the DIV with id='p1_out'
|
![]() ![]() ![]() ![]() ![]() ![]() |
2. (50 points) The DIV block to the left contains the square images for six gauges. This DIV is 200 pixels tall and 400 pixels wide. When the "refresh" button is clicked, the function p2 is executed. The table shown below and to the left contains:
1. a form named "f2" 2. three textboxes for each of the six images' top, left and width properties. When the "refresh" button is clicked, the function named p2 sets the top, left and width style properties for each of the six images. The values in the textboxes are: document.f2.elements[ some_integer ].value where some_integer ranges from 0 to 17.
document.getElementById( id_value ).style.property where id_value are the six strings: "g1", "g2", "g3", ... , "g6"
|