Its only added to the .all array after it has been created. It would
be undefined if you try to access the element before its created.
Before its created it is in the .document.unassigned[] (I think). So
you would have to use an eventlistener to make sure your code doesn't
try to access it before it has been created.

-- 
// Robert Rainwater

On 1/26/2001, 5:25:44 PM EST, Abel wrote about "[Dynapi-Help] Get Div elements":

> ups, but  DynAPI.document.all[id] returns undefined  in NS :(

> the whole hystory is this:

> JSDynLayer1 is being created this way:

> objX = new Obj();

> Obj = function(){
>   ...some stuff
>   this.lyr = new DynLayer(null,x,y,w,h,bgcolor,visible);
>   DynAPI.document.addChild(lyr);
>   this.lyr.elm.owner = this;
>    //so we can know what object have created the HTML layer!
>   ...some stuff
> }

> JSDynLayer1 is later referenced in (javascript generated) HTML, this way:

> <a href="javascript:void(null);"
>    onclick="Obj.click('JSDynLayer1');">
>   click here to do something!
> </a>

> then, when we click the anchor:

> Obj.click = function(id){
>   lyr = DynAPI.document.all[id].owner.lyr; //this fails in NS4!
>   lyr.setBgColor("#000000");
> }


> alert(DynAPI.document.all[id]) shows undefined

> well, i think thats all...
> thanks!

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Robert
> Rainwater
> Sent: Viernes, 26 de Enero de 2001 03:42 p.m.
> To: DynAPI Help List
> Subject: Re: [Dynapi-Help] Get Div elements



> If you are wanting the DynLayer reference use:
> DynAPI.document.all["JSDynLayer1"]

> or

> DynAPI.getDocument("DynDocument1").all["JSDynLayer1"] if you were
> using frames.


> --
> // Robert Rainwater

> On 1/26/2001, 3:16:21 PM EST, Abel wrote about "[Dynapi-Help] Get Div
> elements":

>> Hi there!
>> im having serious problems getting references to dynamically created
>> layers... Somebody knows how to get a reference to a DynLayer object
> knowing
>> only its id (for instance "JSDynLayer1")?.

>> in IE i used this code:
>> document.all["JSDynLayer1"];    //So easy!!

>> but i just cant find a way of doing this in NS 4 +...

>> document.layers, document.layers[idx].layers, etc; are reporting layers
> with
>> ids like this: _js_layer_238, _js_layer_121, etc...

>> And having in mind that the page only has the DynLayer objects i created
> in
>> the onload event, i supose that the problem is that in NS, the DynLayers
> are
>> lossing their ids or something like that.

>> somebody knows whats going on?




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


> ----------------------
> DynAPI Snapshots: http://dynapi.sourceforge.net/snapshot/
> DynAPI Homepage: http://dynapi.sourceforge.net/



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


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


----------------------
DynAPI Snapshots: http://dynapi.sourceforge.net/snapshot/
DynAPI Homepage: http://dynapi.sourceforge.net/



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

Reply via email to