1. (50 points) Two arrays are provided in a vbscript sub named p1. The first is named pn and contains 44 elements (the first is 1) that are the names of the US presidents (e.g., pn[1]="George Washintgton"); the second array is named im and also has 44 elements (first is 1) and contains the image names for each president (e.g., im[1]="president1.jpeg" contain's George Washington's picture). The textbox above is in a form named f1 and is named sv. This textbox tag contains: onKeyUp="p1()". The sub p1 is thus executed every time a user types a character in sv and releases the key. p1 then searches ALL 44 elements of the array named pn looking for all president's names that contain the string in the textbox sv (BOTH values should be converted to uppercase before searching). The sub creates a borderless table that contains one cell for each "matching president". This cell contains: (1) the president's number (1 thru 44); (2) the president's image (im[i]); (3) a <br> tag; and (4) the president's name (pn[i]) (Note: 1 <= i <= 44). This table may have anywhere from zero to 44 cells in its ONLY row, depending on what the user typed. When the searches are done, the resulting table is placed in the span block with id="po" (as shown above for the search of "James"). If no matches are found, display "No Matches" in "po". Show NO HTML. Show ONLY the javascript for p1. |
<XML id="tech_inv_data"> <?xml version="1.0"?> <!DOCTYPE tech_inv [ <!ELEMENT tech_inv (person+)> <!ELEMENT person (first,last,age,yr_exp,yr_com,skill+)> <!ELEMENT first (#PCDATA)> <!ELEMENT last (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT yr_exp (#PCDATA)> <!ELEMENT yr_com (#PCDATA)> <!ELEMENT skill (desc,yr_skill)> <!ELEMENT desc (#PCDATA)> <!ELEMENT yr_skill (#PCDATA)> ]> <tech_inv> <person> <first>Otis</first><last>Cribble</last> <age>41</age> <yr_exp>20</yr_exp> <yr_com>20</yr_com> <skill><desc>ASP.NET</desc> <yr_skill>11</yr_skill></skill> <skill><desc>Oracle</desc> <yr_skill>13</yr_skill></skill> <skill><desc>C</desc> <yr_skill>20</yr_skill></skill> </person><person> <first>Kane</first><last>Jeeves</last> <age>23</age> <yr_exp>2</yr_exp> <yr_com>2</yr_com> <skill><desc>ASP.NET</desc> <yr_skill>1</yr_skill></skill> <skill><desc>HTML</desc> <yr_skill>3</yr_skill></skill> </person> ...lotsa line omitted ... </tech_inv> </XML> |
2. (50 points) For every person in a firm's MIS department, a "technology skills inventory" is maintained. This data is kept in an XML file and is embedded in an HTML page in a data island with id="tech_inv_data". (the DTD and a portion of the XML data are shown to the left). When this button is clicked, a javascript function named p2 is called. This function produces a new page on-the-fly which is a table showing my entire technology capability inventory by person. This two-column table has:
The first name is root.childNodes(i).childNodes(0).text; The last name is root.childNodes(i).childNodes(1).text; The age is root.childNodes(i).childNodes(2).text; The years of experience is root.childNodes(i).childNodes(3).text; The years with the company is root.childNodes(i).childNodes(4).text;
Skills are numbered 5 through root.childNodes(i).childNodes.length;
Show the javascript for p2. Show NO HTML. Show NO XML. |