O'Reilly logo

Platinum Edition Using XHTML™, XML, and Java™ 2 by Andrew H. Watt, Mike Morgan, Jim O'Donnell, Eric Ladd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Position HTML Elements with Dynamic HTML

One exciting possibility with Dynamic HTML is the capability to reposition HTML elements on the Web page. To do this, change the left and top properties of the element's style object (which, in turn, is a property of the element). This change can be done either automatically or in response to user interaction.

Listing 25.6 shows an example of a Dynamic HTML document that enables the user to position an HTML element—in this case a group of pictures—on the Web page. In this example, a table containing three images is contained within a <span> element. An onclick event is attached to the <span>, which is used to toggle whether it can be moved and to initialize the coordinates for the move. An onmousemove ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required