Java Reference
In-Depth Information
exerCises
You can find suggested solutions to these questions in Appendix A.
1. Here's some HTML code that creates a table. Re‐create this table using only JavaScript and the
core DOM objects to generate the HTML. Test your code in all browsers available to you to
make sure it works in them. Hint: Comment each line as you write it to keep track of where you
are in the tree structure, and create a new variable for every element on the page (for example,
not just one for each of the TD cells but nine variables).
<table>
<tr>
<td>Car</td>
<td>Top Speed</td>
<td>Price</td>
</tr>
<tr>
<td>Chevrolet</td>
<td>120mph</td>
<td>$10,000</td>
</tr>
<tr>
<td>Pontiac</td>
<td>140mph</td>
<td>$20,000</td>
</tr>
</table>
2. Modify ch9_example6.html from the “Animating Content” Try It Out so that the amount of
pixels moved in either direction is controlled by a global variable. Call it direction . Remove
the switchDirection variable, and change the code to use the new direction variable to
determine when the animation should change directions.
 
Search WWH ::




Custom Search