I have javascript like and i want to set time delay to this function parameters.here is my simple function
function mopen(id)
{
mcancelclosetime();
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
ddmenuitem = document.getElementById(id);
ddmenuitem.style.visibility = 'visible';
}
and here i want to set a timeout delay with id.I mean
the id should open with a time delay like this
function settimeout(mopen(id),1000)
{
}
But My this try is not working please help me how can i do this
Update
here is my loop function
function hideshow(span) {
hideDiv();
var div = document.getElementById("DIV_" + span.id);
if (div.style.display == "none")
setTimeout(div.style.display = "block",2000);
else
div.style.display = "none";
}
can u please now tell me how to settimeout for the div to become a block.I have set it but its not working
The answer was already given (not in the way you expected, I suppose). Rewrite your function as