Home  >  Article  >  Web Front-end  >  Methods to disable and undisable page buttons_javascript skills

Methods to disable and undisable page buttons_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:59:251660browse

The concept of timer and delayer
//--Timer
// Timer ID number setInterval(callback function, milliseconds);
// Call the callback function every specified milliseconds

// clearInterval (timer ID number)
// Stop the timer with the specified ID number (actually destroying and releasing resources)

//--Delayer
// Delayer ID number setTimeout (callback function, millisecond interval)
// Starting from the call, wait for the specified number of milliseconds and call the callback function once, then end
// Use clearTimeout to clear the delayer

Rendering:

After the page is opened, the following picture will appear: After that, the button value value will decrease by 1 every 1 second until 0. The stop button content will change to agree

Methods to disable and undisable page buttons_javascript skills

Implementation code:

Copy code The code is as follows:



< ;html xmlns="http://www.w3.org/1999/xhtml">









Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn