These projects are retired. The development has stopped and we don't provide support for them anymore.

Dynamic creation

TODO

Source and example output

Example 3-5. Dynamic creation example

<HTML>
<HEAD>
<TITLE>RelativeLayers : Dynamic creation example</TITLE>
<SCRIPT LANGUAGE="JavaScript" SRC="rl_error.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="rl_browser.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="rl_utility.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="rl_window.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="rl_layer.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="rl_limits.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
layer1 = new RelativeLayer(
"layer1Div", "", "",
"100%-20","AUTO",LEFT,"10",TOP,"10","-50%","-50%",
"100%","100%",LEFT,"50%",TOP,"50%","0","0",
"#dddddd");
layer1.setVisible(true);

function createSecondLayer()
{
    var width = Math.floor(Math.random()*70)+10;
    var height = Math.floor(Math.random()*70)+10;
    var leftdistance = Math.floor(Math.random()*100);
    var topdistance = Math.floor(Math.random()*100);

    layer2 = new RelativeLayer(
    "layer2Div", "", "",
    width+"%",height+"%",LEFT,leftdistance+"%",TOP,topdistance+"%","-50%","-50%",
    "100%","100%",LEFT,"50%",TOP,"50%","0","0",
    "#ffffff");
    layer2.addLimit(TOPEDGE, BELOW, "layer1Div", BOTTOM, 10);
    layer2.addLimit(BOTTOMEDGE, ABOVE, "", BOTTOM, -10);
    layer2.addLimit(LEFTEDGE, RIGHTSIDE, "", LEFT, 10);
    layer2.addLimit(RIGHTEDGE, LEFTSIDE, "", RIGHT, -10);
    layer2.addEventListener("create", writeLayer2Contents);
    layer2.createLayer();
    layer2.setVisible(true);
};

function writeLayer2Contents()
{
    layer2.setHtml("<BR>\n<CENTER><B>This layer has been created dynamically.</B></CENTER><BR>");
};
//-->
</SCRIPT>
</HEAD>

<BODY BGCOLOR="#2F4078">

<DIV ID="layer1Div">
    <A HREF='javascript:createSecondLayer();'>create layer</A><BR>
    <A HREF='javascript:layer2.destroyLayer();'>destroy layer</A><BR>
</DIV>

</BODY>

</HTML>

Remarks

TODO