Previous words
One day a whim, 1 minutes repeatedly clicked the blog home page of the refresh post list of the Refresh button. Sure enough, IP was disabled at the time. Later, restart your router, regain the IP to access the blog Park home page. Is it better to set a time limit (say 1 seconds) to prevent the button from being repeatedly clicked?
Idea One
The most straightforward idea may be that the button's event binding function is unbound after the button is clicked, and the function is re-bound after 1s
<button id= "btn" >0</button><script>function Add () { = number ( btn.innerhtml) + 1; NULL ; Cleartimeout (timer); var timer = setTimeout (function() { = add; },+); } </script>
Two ideas
Another idea is to acquire and record time, which is valid when the time interval is greater than 1s when you click again
<button id= "btn" >0</button><script>= (function() { var last = Date.now (); return function () { var now = date.now (); if ((now-last) >1000) { btn.innerhtml= number (btn.innerhtml) + 1; } = Now ; }}) (); </script>
If there are other ideas, please contact
The idea of preventing buttons from repeating clicks within a time limit in JavaScript