Previous Example-|-Next Example-|-Return to Chapter Listing

Example 14.4:
Moving Layers With offset() and moveTo()

[This example works with Netscape Navigator 4. It won't work with Netscape Navigator 2 or 3, or Internet Explorer 3.]

Use the buttons to move the layers. The first button moves the layer left 100 pixels and to the right 100 pixels. The second button moves it to a position 300 pixels from the top of the window and at the left edge.

This text is in layer 1.


This text is in layer 1A.
Movement:


Here are our layers: <LAYER NAME="layer1" LEFT=360 TOP=176 BGCOLOR="#ffff00"><BR> <H1>This text is in layer 1.</H1><BR> <LAYER NAME="layer1A" LEFT=72 TOP=80 VISIBILITY=show BGCOLOR="#8888ff"> This text is in layer 1A. </LAYER> </LAYER> And this is how we moved them: <FORM NAME="layerForm"> <B>Movement:</B> <INPUT TYPE="button" VALUE="offset()" onclick="layers.layer1.offset(-100,100)"> <INPUT TYPE="button" VALUE="moveTo()" onclick="layers.layer1.moveTo(0,300)"> </FORM>
Previous Example-|-Next Example-|-Return to Chapter Listing