【发布时间】:2017-05-31 16:47:28
【问题描述】:
如何防止用户双击按钮?我一直在搜索互联网,但在我的项目中没有什么对我有用。 可以举个例子吗?
我有这个但不工作
<script type = "text/javascript">
function DisableButton() {
document.getElementById("<%=Button1.ClientID %>").disabled = true;
}
window.onbeforeunload = DisableButton;
</script>
【问题讨论】:
-
双击是什么意思?防止用户两次点击两次提交按钮?
-
为什么不在Button1点击事件中写“Button1.enabled = false”而不是javascript函数..?
-
这个问题已经在stackoverflow.com/a/11832053/1863856得到答复