what you have done here is created a <div>
and attempted the use the div's .addEventListener()
member function. It does not have one.
:-)
the following will work
 
<html>
<head>
<title>DynAPI Distribution: Inline Layers Example</title>
<script language="JavaScript" src="./src/dynapi.js"></script>
 
<!-- You must include the following scripts to make it happen -->
 
<!-- browser detection object. This is used by the other objects
to make the whole deal cross-borwser -->
<script language="Javascript" src="./src/lib/dynapi/api/browser.js"></script>
 
<!-- the basic layer object -->
<script language="Javascript" src="./src/lib/dynapi/api/dynlayer.js"></script>
 
<!-- the DynAPI.document functions... -->
<script language="Javascript" src="./src/lib/dynapi/api/dyndocument.js"></script>
 
<!-- enabled events: such as the  EventListener() object and the DynLayer function .addEventListener()-->
<script language="Javascript" src="./src/lib/dynapi/api/events.js"></script>
 
<script language="Javascript">
DynAPI. {
 

 layer1 = new DynLayer(); // create an instance of the DynLayer object (this is your Layer)
 
 //Add the layer to the document.. This must be done so that the object can be acces via DynAPI object arrays
 DynAPI.document.addChild(layer1);
 
 layer1.moveTo(100,100);   // move the layer to position 100 pixels form the top and 100 pixels from the left
 layer1.setSize(100,100);   // make the layer 100 pixels wide by 100 pixels heigh
 layer1.setBgColor('#33cc66'); // set the layer's background color
 layer1.setVisible(true);  // make the layer visible
 
  
 var myevent1 = new EventListener(layer1); //Create an event listener for Layer1
 myevent1. {     //set the event listener to listen for mousup events
  alert('Click');
 }
 layer1.addEventListener(myevent1);     // attach the event listener to the layer
}
</script>
</head>
<body>
<a href="javascript:layer1.setBgColor('red')">Change Color</a>
</body>
</html>
 

<html>
<head>
<title>DynAPI Distribution: Inline Layers Example</title>
 
<script language="JavaScript" src="./src/dynapi.js"></script>
<script language="Javascript">
DynAPI.setLibraryPath('./src/lib/')
DynAPI.include('dynapi.api.*')
DynAPI.include('dynapi.ext.inline.js')
</script>
<script language="Javascript">
 
DynAPI. {
 var layer1 = this.document.all['layer1']
 layer1.moveTo(100,100)
 layer1.setBgColor('#F8F8F8')
 layer1.setVisible(true)
 
 var myevent1 = new EventListener(this.document)
 myevent1. {
  alert('Click')
 }
 layer1.addEventListener(myevent1)
}
 
</script>
</head>
 
<body>
<div id="layer1" style="position:absolute; visibility:hidden">This is a test</div>
<!-- ******** how can I get this href to work ***************-->
<a href="javascript:layer1.setBgColor('red')">Change Color</a>
 
</body>
</html>

Reply via email to