禁用按钮和确认提交如何结合?
在网上看到了禁用按钮的例子,试了一下。但加上确认提交窗口就有问题。
代码如下:
<head runat= "server ">
<title> 无标题页 </title>
<script language= "javascript " type= "text/javascript ">
function check(b){
if(confirm( "提交吗? "))
{
b.disabled=true;
return true;
}else{
return false;
}
}
</script>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:Button ID= "Button1 " UseSubmitBehavior= "false " runat= "server " Text= "Button " OnClick= "Button1_Click " OnClientClick= "check(this); " />
</div>
</form>
</body>
</html>
现在探出提示对话框后,无论我选是或者否都会触发提交怎么办?还忘各位大侠指点
------解决方案-------------------- <form id= "form1 " runat= "server ">
<div>
<asp:Button ID= "Button1 " UseSubmitBehavior= "false " runat= "server " Text= "Button " OnClick= "Button1_Click " OnClientClick= "if(check(this)==false){return false;} " />
</div>
</form>
</body>
</html>