Layer Create/Remove/Delete : Layer Creation « Ajax Layer « JavaScript DHTML






Layer Create/Remove/Delete


http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
<html>
<head>
<title>DynAPI - DynLayer Create/Remove/Delete</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath('./dynapisrc/');
dynapi.library.include('dynapi.api');
</script>
<script language="Javascript">

w = new DynLayer();
w.setBgColor('white');
w.setSize(130,130);
w.setLocation(250,50);

b = new DynLayer();
b.setBgColor('black');
b.setSize(100,100);
b.setLocation(400,50);

r = new DynLayer();
r.setBgColor('red');
r.setSize(50,50);

dynapi.document.addChild(w);
dynapi.document.addChild(b);

</script>
</head>
<body bgcolor="#999999">

<p>This is not working, and will be fixed in a next release:

<p>R: add to <a href="javascript://" onClick="w.addChild(r)">W</a>, <a href="javascript://" onClick="b.addChild(r)">B</a><br>
R: remove from <a href="javascript://" onClick="r.removeFromParent()">[parent]</a>, <a href="javascript://" onClick="w.removeChild(r)">W</a>, <a href="javascript://" onClick="b.removeChild(r)">B</a>

<script>
dynapi.document.insertAllChildren();
</script>

</body>
</html>

           
       








dynapi.zip( 791 k)

Related examples in the same category

1.Generate and destroy layers
2.This is an inline layer that was created after page load
3.Relative Layers : Dynamic creation example
4.Relative Layers : Basic example
5.Layer Inline
6.Relative Layers