Again, if you reading this post in a feed reader you may need to click through to the actual post to see this working. ![]() The name of the variable can be whatever you want, but it needs to be in the global scope, hence the "var timeout " declaration at the start of the code.Ĭlicking the "test timeout" button starts the timer and the "clear timeout" button clears the timeout at the end. setTimeout () tTimeout () allows you to specify that a piece of JavaScript code (called an expression) will be run a specified number of milliseconds from when the setTimeout () method was called. ![]() ![]() When timeout_init() is called, the timeout reference is stored in the "timeout" variable. Timeout = setTimeout('timeout_trigger()', 3000) ĭocument.getElementById('timeout_text').innerHTML = 'The timeout has been started' ![]() Document.getElementById('timeout_text').innerHTML = 'The timeout has been triggered' ĭocument.getElementById('timeout_text').innerHTML = 'The timeout has been cleared'
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |