Click to See Complete Forum and Search --> : Help to solve problem: initialization layers in NN4
kost81
05-24-2003, 02:55 PM
Can’t initialize internal layer in NN4.There are two layers child_layer and paren_layer.child_layer is within parent_layer. Itry to initialize such way
child_layer.init(parent_layer);
in function init
this.elem=parent_layer.document.layers[‘child_layer’];
child_layer doesn’t want to initialize
What to do?
khalidali63
05-24-2003, 03:05 PM
what do you mean you can't initialize?
are you not able to access the child layer?
My personal experience,I always define div id's in the csssomething like
#parentDiv{
position:absolute;
}
#childDiv{
position:absolute;
}
now you can access them
document.layers.parentDiv.document.layers.childDiv
gil davis
05-24-2003, 05:55 PM
First, the layers must exist. Hopefully, you are calling the function init() on load.
Second, you need to specify "document" for it to find the parent layer:this.elem = document.layers['parent_layer'].document.layers[‘child_layer’];
kost81
05-24-2003, 11:16 PM
Of course I spesify parent_layer at first.
I have new thought about origin my problem
Maybe this problem appears because I'm creating my layers at fly by "write"
gil davis
05-25-2003, 08:36 AM
post a link
kost81
05-26-2003, 01:42 AM
Project is not in web yet
I'll show piece of code
wind=code(i);
wind_tips[i]=new DHTMLObject(this.id+i);
wind_tips[i].draw(left,top,width,height,fon_scr,0,9,'okno',wind);
wind_tips[i].init();//here I initialize parent_layer
if (can_drag) {
wind_tips[i].dragobj=-1;
head[i]=new DHTMLObject("head"+i);
head[i].init(wind_tips[i].id);//here I initialize child layer
}
function DHTMLObject(id){
this.id=id;
if(!bw.bw) return;
this.name='DHTMLObject_'+this.id;
this.init=function(ns4p){
this.el=bw.dom?document.getElementById(this.id):bw.ie4?document.all[this.id]:bw.ns4?
eval((ns4p?ns4p:'')+"document.layers."+this.id):0;
this.draw=function(x,y,w,h,bg,v,z,css,code){
document.write(bw.ns4?
'<layer id="'+this.id+'" z-index='+z+' left='+x+' top='+y+' width='+w+
' height='+h+(!v?' visibility=hidden':'')+(bg!=""?' bgcolor="'+bg+'"':'')+
(css!=''?' class="'+css+'"':'')+'>'+code+'</layer>':
'<div id="'+this.id+'" style="position:absolute;z-index:'+z+';left:'+x+'px;top:'+y+
'px;width:'+w+'px;'+(!v?'visibility:hidden;':'')+(bg!=""?''+(bw.ns4?'layer-':'')+
'background-color:'+bg+';':'')+'"'+(css!=''?' class="'+css+'"':'')+'>'+code+'</div>');
}
}
something like that
gil davis
05-26-2003, 09:57 AM
Project is not in web yet
I'll show piece of code
...
something like that
I guess you are not too serious about wanting help yet.;-)
This forum gives you the option of attaching files. You can zip up the entire project and attach it to your next post. See "Attach file:" below "Your Reply:".