Jul 27, 2006 #1 Diggum1 Programmer Joined Oct 14, 2004 Messages 67 Location US How can I delay the firing of this function by 2 seconds? The following is not working. function showlayer(whichLayer) { document.getElementById(whichLayer).style.display = 'block'; setTimeout("showlayer()",2000); } Thanks Rick
How can I delay the firing of this function by 2 seconds? The following is not working. function showlayer(whichLayer) { document.getElementById(whichLayer).style.display = 'block'; setTimeout("showlayer()",2000); } Thanks Rick
Jul 27, 2006 #2 cLFlaVA Programmer Joined Jun 14, 2004 Messages 6,450 Location US you will need to do it from wherever you're calling the function. for example: Code: <input type="button" onclick="setTimeout('showlayer(\'theLayerId\')', 2000);" value="hi" /> *cLFlaVA ---------------------------- [tt]somebody set up us the bomb![/tt] [URL unfurl="true"]http://www.coryarthus.com/[/url] Upvote 0 Downvote
you will need to do it from wherever you're calling the function. for example: Code: <input type="button" onclick="setTimeout('showlayer(\'theLayerId\')', 2000);" value="hi" /> *cLFlaVA ---------------------------- [tt]somebody set up us the bomb![/tt] [URL unfurl="true"]http://www.coryarthus.com/[/url]
Jul 27, 2006 Thread starter #3 Diggum1 Programmer Joined Oct 14, 2004 Messages 67 Location US thanks, works great. Upvote 0 Downvote