Share
Explore BrainMass

A simple example of dynamic HTML

Chapter Title - Dynamic XHTML Documents with JavaScript

Exercise 1

Create a document (with any required style sheets and java .js files) that displays a sports related image of your choice and three buttons. The buttons should be labeled simply 1,2, and 3. When pressed, each button should change the content of the image to that of a different image.

Exercise 2

Create a document that contains four short paragraphs of text, stacked on top of each other, with only enough of each showing so that the mouse cursor can always be placed over some part of them. When the cursor is placed over the exposed part of any paragraph, it should rise to the top to become completely visible. When a paragraph is moved from the top stacking position, it must return to its original position rather than the bottom.

Solution Preview

Both of these problems require using javascript to respond to a users
actions. In the image swapping problem the user clicks on a button to
cause the image src file to change. In the "top paragraph" problem
the user's mouse movements trigger the javascript to change the order
of ...

Solution Summary

This solution provides a simple but common example of using javascript to create dynamic HTML. The solution provides two applications. The first one swaps images when a button is pressed. The second one shows how to have layered paragraphs where only one is visible at a time.

$2.19