87,922
社区成员
发帖
与我相关
我的任务
分享
<input type="button" onclick="disButton(this)" value="click me">
function disButton(self){
self.disabled = true;
setTimeout(function(){
self.disabled = false;
}, 5000)
}
<!doctype html>
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<button id="test">test</button>
<script>
function $(o){return document.getElementById(o)}
$('test').onclick = function(){
alert('test');
this.disabled = true;
setTimeout(fn, 2000);
}
function fn(){
$('test').disabled = false;
}
</script>
</body>
</html>