webguync Posted July 7, 2010 Share Posted July 7, 2010 Hi, I am looking to do something similar to the timer code below except, I don't want the user to have to press a button to get the alert, I want it to appear automatically after 1 hour (60 min). How would I alter the code to do this? <html> <head> <script type="text/javascript"> function timedMsg() { var t=setTimeout("alert('5 seconds!')",5000); } </script> </head> <body> <form> <input type="button" value="Display timed alertbox!" onClick="timedMsg()" /> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
jug Posted July 7, 2010 Share Posted July 7, 2010 you want something like <html> <head> <script type="text/javascript"> function startTimer(){ var t = setTimeout("alert('5 seconds!')",5000); } </script> </head> <body onload="startTimer();"> //html here </body> </html> though edit it for 60 mins hope this helps Quote Link to comment Share on other sites More sharing options...
webguync Posted July 7, 2010 Author Share Posted July 7, 2010 ok, thanks. Will give it a try. So for 60 minutes it will be.. function startTimer(){ var t = setTimeout("alert('1 Hour!')",3600000); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.