100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > JS控制按钮防止多次点击

JS控制按钮防止多次点击

时间:2021-04-17 17:43:07

相关推荐

JS控制按钮防止多次点击

<!DOCTYPE html><html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script type="text/javascript">// 按钮防止短时间多次点击//全局变量标识var CLICKTAG = 0;function button_onclick(pElement){if (CLICKTAG == 0) { CLICKTAG = 1; pElement.disabled=true;// 等待3s后重置按钮可用setTimeout(function () { CLICKTAG = 0 ; pElement.disabled=false;}, 3000); }}</script></head><body><input type="button" style="width:125px;height:25px;" value = "点击" οnclick="button_onclick(this)" ></button></body></html>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。