1. (50 points) The data to the left has: a form named f1; a button labelled "execute p1" that executes the javascript function named p1; and a set of choices to determine how to frame and display the image named "capt0001.gif". The values shown in bold-face to the left are the HTML object names. p1 produces a new page (on-the-fly) with three parts: (1) the main image capt0001.gif (ih by iw pixels); surrounded by a colored mat (md pixels wide of color red=cr; green=cg; blue=cb); and a frame surounding the mat composed of four images (2 vertical and 2 horizontal images) of the chosen wood.
Notes: and backgroundColor:rgb(cr,cg,cb) with z-index:1
Write only the javascript code for p1. Show NO HTML. |
<XML id="mg"> <?xml version="1.0"?> <!DOCTYPE top_grossing_movies [ <!ELEMENT top_grossing_movies(reportdate,movie+)> <!ELEMENT reportdate (#PCDATA)> <!ELEMENT movie (title,year,gross)> <!ELEMENT title (#PCDATA)> <!ELEMENT year (#PCDATA)> <!ELEMENT gross (#PCDATA)> ]> <top_grossing_movies> <reportdate>April 27 2012</reportdate> <movie><title>Avatar</title><year>2009</year> <gross>760,505,847</gross></movie> <movie><title>Titanic</title><year>1997</year> <gross>600,779,824</gross></movie> <movie><title>The Dark Knight</title><year>2008</year> <gross>533,316,061</gross></movie> <movie><title>Star Wars: Episode IV - A New Hope</title> <year>1977</year> <gross>460,935,665</gross></movie> <movie><title>Shrek 2</title><year>2004</year> <gross>436,471,036</gross></movie> ...lotsa movies missing ... <movie><title>You Don't Mess with the Zohan</title> <year>2008</year> <gross>100,018,837</gross></movie> <movie><title>Die Hard: With a Vengeance</title> <year>1995</year> <gross>100,012,500</gross></movie> <movie><title>Collateral</title><year>2004</year> <gross>100,003,492</gross></movie> </top_grossing_movies></XML> |
2. (50 points) An XML data island with id=mg contains information on all US movies that have grossed more than $100 million in descending gross revenue order. The DTD and a small partial list of the data is shown to the left. Using this XML data create TWO reports:
• a 4 column report that has: • in first table row the reportdate or root.childNodes[0].text • then for each movie produce one row (there are 1 to root.childNodes.length movies) containing: • rank (for the 1st movie the rank is 1, the 2nd is 2, etc.) • title of the movie is root.childNodes[i].childNodes[0].text • year is root.childNodes[i].childNodes[1].text • gross US revenue is root.childNodes[i].childNodes[2].text • a 7 row 2 column report that contains a count of the number of movies in the second column and the 7 labels below in the first column:
Show NO HTML. Show only the javascript for p2. |