Initialization of DynLayers

The DynLayer can be applied to any layer using this general format:

objectName = new DynLayer(id,nestref)

Simple Layer Example:

Let's say you have a very simple layer with this structure:

<STYLE>
#mylayerDiv {position:absolute; left:30; top:50;}
</STYLE>

<DIV ID="mylayerDiv"></DIV>

To initialize 'mylayerDiv', your javascript will be:

mylayer = new DynLayer('mylayerDiv')

Notice how I append the 'Div' extension on the ID of the layer. This is because the name of the object cannot be the same as the ID of the layer.

Nested Layer Example:

<DIV ID="myparentDiv">
	<DIV ID="mylayerDiv"></DIV>
</DIV>

To initialize 'mylayerDiv':

mylayer = new DynLayer('mylayerDiv','myparentDiv')

Notice the name of the parent layer is passed for the nestref argument.

Multiple Nesting:

<DIV ID="myparent1Div">
	<DIV ID="myparent2Div">
		<DIV ID="mylayerDiv"></DIV>
	</DIV>
</DIV>

If the layer is nested multiple times you must pass the names of all layers in that hierarchy separated by '.document.':

mylayer = new DynLayer('mylayer','myparent1Div.document.myparent2')

Initialization Demo:

View dynlayer-init1.html for an example showing various initializations.

The Dynamic Layer Object

Home Next Lesson: Geometric Objects
copyright 1998 Dan Steinman