[Javascript] export variables outside function

aw alfwro at wp.pl
Thu Jan 2 14:04:40 CST 2003


Hi,
I have problem with this function:

function open(cityName) {
var windowOpen = eval(cityName + "Obj"); 
windowOpen.visibility = "visible"
var x_poz = parseInt(windowOpen.left);

if (x_poz <120) {
windowOpen.left = x_poz +15;
setTimeout("open()",1);
}
}

So I have two question
1. How to make it work, or
2. One way is to expport variable windowOpen and 
x_poz outside the function and make two function: 
first reading and seting the variables and second 
with setTimeout stuf - like this:

function open(cityName) {
var windowOpen = eval(cityName + "Obj"); 
windowOpen.visibility = "visible"
var x_poz = parseInt(windowOpen.left);
animate();
}

function animate() {
if (x_poz <120) {
windowOpen.left = x_poz +15;
setTimeout("animate()",1);
}
}

But this won't work. Any ideas??

Regards
Andrzej



More information about the Javascript mailing list