Hi there-
I am trying to implement the DynAPI to create layers on the fly
generating _javascript_ from PHP which loops and creates the layers.
However, these layers created on the fly do not respond to the
functions included in the API. For example, in the code below I can
move 'testLayer' but I cannot get layer a[1] to move. I also tried
changing the name of the layer to a concatenated all text name (ex:
myLayer1, myLayer2) but the layers are still causing a DynAPI error.
Please help! Here is the compiled code I am using:
<html>
<head>
<title>DynAPI Distribution: Create Example</title>
<script language="_javascript_" src="">/script>
<script language="_javascript_">
DynAPI.setLibraryPath('src/lib/');
DynAPI.include('dynapi.api.*');
</script>
<script language="_javascript_">
var divContent=[];
divContent[0] = "null";
divContent[1] ="<a href="" >img src="">/a>";
<head>
<title>DynAPI Distribution: Create Example</title>
<script language="_javascript_" src="">/script>
<script language="_javascript_">
DynAPI.setLibraryPath('src/lib/');
DynAPI.include('dynapi.api.*');
</script>
<script language="_javascript_">
var divContent=[];
divContent[0] = "null";
divContent[1] ="<a href="" >img src="">/a>";
divContent[2] ="<a href=""
border=0><img src=""
hspace=2 vspace=2></a>;
divContent[3] ="<a href=""
>img
src="">/a>";
divContent[4] ="<a href=""
>jpg');\" border=0><img
src="" hspace=2
vspace=2></a>;
divContent[5] ="<a href=""
>img
src="">/a>";
divContent[6] ="<a href=""
>g');\" border=0><img
src="" hspace=2
vspace=2></a>;
DynAPI. {
var a=[];
var divCount=0;
var a=[];
var divCount=0;
for (var i=1;i<6;i=i+2){
a[i] = new
DynLayer();
DynAPI.document.addChild(a[i]);
a[i].setSize(400,20);
a[i].setBgColor('orange');
a[i].setX(30);
a[i].setY((50+25*divCount));
a[i].setHTML(divContent[i]);
a[i+1] = new DynLayer();
DynAPI.document.addChild(a[i+1]);
a[i+1].setSize(400,20);
a[i+1].setBgColor('yellow');
a[i+1].setX(30);
a[i+1].setY((75+25*divCount));
a[i+1].setVisible(false);
a[i+1].setHTML(divContent[(i+1)]);
divCount++;
}
testLayer = new DynLayer();
DynAPI.document.addChild(testLayer);
testLayer.setSize(50,50);
testLayer.setBgColor('yellow');
testLayer.setX(400);
testLayer.setY(400);
}
function hideShow(thisDiv) {
testLayer.moveBy(0,50);
//}
}
</script>
</head>
<body bgcolor="#ffffff">
...
</body>
</html>
DynAPI.document.addChild(a[i]);
a[i].setSize(400,20);
a[i].setBgColor('orange');
a[i].setX(30);
a[i].setY((50+25*divCount));
a[i].setHTML(divContent[i]);
a[i+1] = new DynLayer();
DynAPI.document.addChild(a[i+1]);
a[i+1].setSize(400,20);
a[i+1].setBgColor('yellow');
a[i+1].setX(30);
a[i+1].setY((75+25*divCount));
a[i+1].setVisible(false);
a[i+1].setHTML(divContent[(i+1)]);
divCount++;
}
testLayer = new DynLayer();
DynAPI.document.addChild(testLayer);
testLayer.setSize(50,50);
testLayer.setBgColor('yellow');
testLayer.setX(400);
testLayer.setY(400);
}
function hideShow(thisDiv) {
testLayer.moveBy(0,50);
//}
}
</script>
</head>
<body bgcolor="#ffffff">
...
</body>
</html>