DynAPI.document is not intialized until the page is loaded so you need
to put all of that code inside of the DynAPI.onLoad function.

-- 
Robert Rainwater


On 4/18/2001, 7:07:33 PM EST, Ben wrote about "[Dynapi-Help] Catching events on the 
document":

> I am building a select list widget, and I wish to catch the mousedown event on the 
>document, in order to close the select box if it is open. I have tried the following 
>code, but I get an error
> saying 'DynAPI.document is null or not an object' (referring to the first line of 
>the EventListener).

> This doesn't make since I have already added my select list widget to the 
>DynAPI.document object as a child (haven't I?!!!)

> Any help appreciated, Ben 

> -------------------code start---------------------

>  <script language="JavaScript" src="../dynapi2_51/dynapi/src/dynapi.js"></script>
>  <script language="Javascript">
 
>   DynAPI.setLibraryPath('../dynapi2_51/dynapi/src/lib/');
  
>   DynAPI.include('dynapi.api.*');
>   DynAPI.include('dynapi.event.*')
>   DynAPI.include('dynapi.gui.label.js')
>   DynAPI.include('dynapi.gui.list.js')
>   DynAPI.include('dynapi.util.thread.js')
>   DynAPI.include('dynapi.util.pathanim.js');
>   DynAPI.include('selectList.js','./')
  
>   DynAPI.onLoad=function() {
>    select1 = new selectList('test')
>    DynAPI.document.addChild(select1)
>   }
  
>   DynAPI.document.events = new EventListener(DynAPI.document)
>    DynAPI.document.onmousedown=function(e){
>     alert('test')
>    }
>   DynAPI.document.addEventListener(DynAPI.document.events)
 
>  </script>

> --------------------code end----------------------------



_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to