problem passing parameters to function that is a parameter itself in setTimeout()
Hello
I am having a small problem which I thought I resolved a while back...unfortunately it's back
it's a dropdown layer that waits 1 second before closing.
here is my code
Code:
<script>
var delay;
function swap()
{
var nameOfLayer = swap.arguments[0];
if(window.delay)
{
clearTimeout(delay);
}
if(swap.arguments[1] == 1)
{
document.getElementById(nameOfLayer).style.visibility = "visible";
}
else
{
document.getElementById(nameOfLayer).style.visibility = "hidden";
}
}
function wait()
{
var n = wait.arguments[0];
delay = setTimeout("swap(' + n + ',2)",1000);
// if i change ' + n + ' to the name of layer it works fine
// delay = setTimeout("swap('lay1',2)",1000);
}
</script>
here is how I call the function
Code:
<p><a href = "" onMouseover="swap('lay1',1)" onMouseout="wait('lay1')" >Wawryn Classroom</a></p>
i always have problems passing parameters to a function that is itself a parameter of the setTimeout function
any help will be appreciated
bsw