david_stev
02-10-2003, 02:00 PM
I am using the following code to move layers depending on the users resolution. Before this I use ASP to draw the layers utilising arrays meaning that updating layer content is faster.
at the moment the arrays contain test data.
Think that my syntax may be wrong on the following line:
document.all.layer + counter[ii] + .style.left = + position[ii];
PS jsNumber is a var passed from the ASP so the Javascript only tries to move the correct no of layers and does not error.
<script language="JavaScript">
// JAVASCRIPT USED AFTER THE LAYERS HAVE BEEN DRAWN
// IN ASP TO MOVE THE LAYERS
// DEPENDING ON RESOLUTION
// CALLED FROM onLoad IN BODY TAG
function moveLayers() {
jsNumber = document.numberFrm.jsNumber.value;
var string
var ii
var correctwidth=800
var correctheight=600
var position = new Array(8)
position[1] = "100"
position[2] = "100"
position[3] = "200"
position[4] = "200"
position[5] = "300"
position[6] = "300"
position[7] = "498"
position[8] = "471"
var counter = new Array(8)
counter[1] = "1"
counter[2] = "2"
counter[3] = "3"
counter[4] = "4"
counter[5] = "5"
counter[6] = "6"
counter[7] = "7"
counter[8] = "8"
if (screen.width==correctwidth || screen.height==correctheight) {
ii = 1
do
{
document.all.layer + counter[ii] + .style.left = + position[ii];
ii++
}
while (ii <= jsNumber)
}
}
</script>
Any help greatly appreciated.
at the moment the arrays contain test data.
Think that my syntax may be wrong on the following line:
document.all.layer + counter[ii] + .style.left = + position[ii];
PS jsNumber is a var passed from the ASP so the Javascript only tries to move the correct no of layers and does not error.
<script language="JavaScript">
// JAVASCRIPT USED AFTER THE LAYERS HAVE BEEN DRAWN
// IN ASP TO MOVE THE LAYERS
// DEPENDING ON RESOLUTION
// CALLED FROM onLoad IN BODY TAG
function moveLayers() {
jsNumber = document.numberFrm.jsNumber.value;
var string
var ii
var correctwidth=800
var correctheight=600
var position = new Array(8)
position[1] = "100"
position[2] = "100"
position[3] = "200"
position[4] = "200"
position[5] = "300"
position[6] = "300"
position[7] = "498"
position[8] = "471"
var counter = new Array(8)
counter[1] = "1"
counter[2] = "2"
counter[3] = "3"
counter[4] = "4"
counter[5] = "5"
counter[6] = "6"
counter[7] = "7"
counter[8] = "8"
if (screen.width==correctwidth || screen.height==correctheight) {
ii = 1
do
{
document.all.layer + counter[ii] + .style.left = + position[ii];
ii++
}
while (ii <= jsNumber)
}
}
</script>
Any help greatly appreciated.