I didn't mean to indicate that your question was
silly.
Only that the answers are there to be
found.
If you didn't understand what you read, we probably
can't help you..
I mean that you'd be better off reading an advanced
Javascript totorial.
Alright:
ns6 //note: I am not very strong on
DOM, someone may want to correct me or fill in the blanks
//find the parent
of the new layer
var
parentElement=(this.parent.isDynLayer)?this.parent.elm:this.parent.doc.body;
//add a 'range' to the parent : same as adding an element? Maybe an empty HTML element
//add a 'range' to the parent : same as adding an element? Maybe an empty HTML element
var r =
parentElement.ownerDocument.createRange();
//I assume this tells the 'range' where in the document it starts
//I assume this tells the 'range' where in the document it starts
r.setStartBefore(parentElement);
//create the
HTML layer element (<div> or
<layer>)
var ptxt =
r.createContextualFragment(this.getOuterHTML());//probably add's it to the document
parentElement.appendChild(ptxt);
//DynAPI stuff..
//This allows
DynAPI internal code to acces the object's JS Object
//(the DynLayer is
actualy an object that contains a Layer object)
this.elm=parentElement.lastChild;
//gives DynAPI direct access to the CSS properties of the layer object
//gives DynAPI direct access to the CSS properties of the layer object
this.css=this.elm.style;
//give a
reference to the
object's document
this.doc=this.parent.doc;
this.doc=this.parent.doc;
---
IE: //uses Microsft DOMish syntax to
create the layer:
//find a reference
to the parent of the new layer
var
parentElement=(this.parent.isDynLayer)?this.parent.elm:this.parent.doc.body;
//obtain a reference to the actual layer object
//create the
HTML layer element (<div> or
<layer>)
parentElement.insertAdjacentHTML("beforeEnd",this.getOuterHTML());//obtain a reference to the actual layer object
this.elm=parentElement.children[parentElement.children.length-1];
//obtain a reference to the new layer's CSS attributes
//obtain a reference to the new layer's CSS attributes
this.css=this.elm.style;
//Obtain a
reference to the new Layer's
document
this.doc=this.parent.doc;
this.doc=this.parent.doc;
And I think you said you understood the NS4
stuff..
I should add that to avoid memory leaks in NS4, any
layers that area deleted are put into and
array instead of being actually deleted so that
they can be re-used the next time we need a layer.