因为服务器响应比较慢,用户提交表单后会等待一段时间,可能会造成用户以为没反应重复点击提交按钮.
<script type="text/javascript">
var checkSubmitFlg = false;
function checkSubmit(){
if (checkSubmitFlg == true){
return false;
}
checkSubmitFlg = true;
return true;
}
document.ondblclick = function docondblclick(){
window.event.returnValue = false;
}
document.onclick = function doconclick(){
if (checkSubmitFlg){
window.event.returnValue = false;
}
}
</script>
<form action="" method="post" οnsubmit="return checkSubmit();">