版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/RodeStillFaraway/article/details/78611868
<!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 = "点击" onclick="button_onclick(this)" ></button>
</body>
</html>