...

New layers definition in NS4 using Javascript

meterlink
06-21-2002, 04:09 PM
Hello, I need help urgently !!!
How to define in NS4 new layers using Javascript only, i.e. without "div" or "layer" commands
in html body ? could you please send an answer
to my email also : safro@wisdom.weizmann.ac.il
or you can explain why this example is not working ?

thank you very much

function x()
{
var LR = document.layers["id"]=new Layer(100);
LR.name= "id";
LR.left= 100;

LR.top = 96;
LR.clip.height=13;
LR.visibility='show';
LR.zIndex=1;
LR.bgColor=red;

}

jkd
06-21-2002, 04:43 PM
var myLayer = new Layer(200, window);

That creates a top-level layer 200px wide.

Then you modify it through the reference of myLayer. The second argument I believe is optional, and defaults to window if not specified. You can also provide references to other layer objects as the second argument, and the layer you are creating becomes a child of it.

meterlink
06-21-2002, 04:55 PM
It is not comming to the alert !

<html>
<script language="Javascript1.2">
function x()
{
var myLayer = new Layer(200, window);
alert('test');
}
</script>
<body>
<script language="Javascript1.2">
x();
</script>
</body>
</html>

jkd
06-21-2002, 05:14 PM
http://developer.netscape.com/docs/manuals/communicator/dynhtml/layers33.htm#1070570

That says you can *only* use new Layer() AFTER the page has loaded.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum