Intelly XAD Posted October 18, 2006 Share Posted October 18, 2006 Hi, I was wondering if there is a possibility to stop or break an setTimeoutFor example, when you have:setTimeout('hello()', 5000);hello() wil be executed in 5 seconds, but I was wondering if ik could be stopped when an other command is executedMany thnx in Advance Quote Link to comment https://forums.phpfreaks.com/topic/24330-breaking-an-settimeout/ Share on other sites More sharing options...
tomfmason Posted October 18, 2006 Share Posted October 18, 2006 yes. first you will need do declare a varaiable before you set the time out. Here is a simple example.[code=php:0]//our timer variablevar timer;function startTimer() { timer = setTimeout('hello();', 5000);}function stopTimer() { clearInterval(timer);}[/code]Hope that helps,Tom Quote Link to comment https://forums.phpfreaks.com/topic/24330-breaking-an-settimeout/#findComment-110671 Share on other sites More sharing options...
Intelly XAD Posted October 18, 2006 Author Share Posted October 18, 2006 Yes that helped very good, thnx :D Quote Link to comment https://forums.phpfreaks.com/topic/24330-breaking-an-settimeout/#findComment-110887 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.