msiedle
asked on
Passing parameters to function from within setTimeout ?
Hi all
I've got a SwitchMenu function that hides or shows a div tag onMouseOver...and I'm trying to introduce a delay of half a second or so ...but I can't seem to pass the 'sub3' parameter to the function correctly from my code ...can someone offer advice?
This is my code without the setTimeout:
<div class="navHeaderCursorArro w" onMouseOver="SwitchMenu('s ub3')">Sec ure Login</div>
works fine ...
Then i try adding the setTimeout:
<div class="navHeaderCursorArro w" onMouseOver="setTimeout('S witchMenu( )', 1250, 'sub3');">Secure Login</div>
and not working at all :-(
btw ...my SwitchMenu function is below:
function SwitchMenu(obj){
if(document.getElementById ){
var el = document.getElementById(ob j);
var ar = document.getElementById("m asterdiv") .getElemen tsByTagNam e("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu ") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
Thanks
Mark
I've got a SwitchMenu function that hides or shows a div tag onMouseOver...and I'm trying to introduce a delay of half a second or so ...but I can't seem to pass the 'sub3' parameter to the function correctly from my code ...can someone offer advice?
This is my code without the setTimeout:
<div class="navHeaderCursorArro
works fine ...
Then i try adding the setTimeout:
<div class="navHeaderCursorArro
and not working at all :-(
btw ...my SwitchMenu function is below:
function SwitchMenu(obj){
if(document.getElementById
var el = document.getElementById(ob
var ar = document.getElementById("m
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
Thanks
Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
M