people
can someone help me plz?
 
<html>
<head><title>Deleting layers</title>
 
<script language="Javascript" src="dynapi/src/dynapi.js"></script>
 
<script language="Javascript">
 
DynAPI.setLibraryPath('dynapi/src/lib/')
 
DynAPI.include('dynapi.api.browser.js')
DynAPI.include('dynapi.api.dynlayer.js')
DynAPI.include('dynapi.api.dyndocument.js')
 
function MakeLayer(){
 layer=new DynLayer(null,Math.random()*400,Math.random()*400,50,50,'#c0c0c0')
 DynAPI.document.addChild(layer)
}
 
function DeleteLayer(){
 if (DynAPI.document.children.length>0) {
  var index=DynAPI.document.children.length-1
  DynAPI.document.children[index].deleteFromParent()
 } else alert('all layers are removed')
}
 

</script>
</head>
 
 
--------------- option 1
<body>
<a href="javascript:MakeLayer()">Make layer</a><br>
<a href="javascript:DeleteLayer()">Delete layer</a>
 
</body>
</html>
 
--------------- option 2
<script language="Javascript">
MakeLayer()
</script>
 
 
option 1 works, option 2 doesn't
Why?  he doesn 't find DynAPI.document (it is false)
 
Why is this in option 2 like that and not in option 1 ?
 
I would be thankfull for a solution
 
Greetingz
Derf

Reply via email to