js否返回false了按钮还执行PostBackUrl怎么办
<script language='javascript' type="text/javascript">
function checkdate() {
var bdate = document.getElementById("BeginDate").value;毕业论文
var edate = document.getElementById("EndDate").value;
if (bdate.length == 0 || edate.length == 0) {
alert("请选择起始时间或截止时间!");
return false;
}
else{return true;}
}
</script>
【上面是JS下面是按钮代码】
<asp:Button ID="CheckBtn" runat="server" Text="查询" PostBackUrl="~/result.aspx" OnClientClick="checkdate()" />
=====================================================
当条件(bdate.length == 0 || edate.length == 0)符合时,弹出了警告窗,可是点确定后页面还是继续跳到result.aspx页面,求解决方法!!!!我希望是点掉警告窗后不执行跳转页面啊!条件不符合的时候再跳转
OnClientClick="return checkdate()"
缺少一个return
1 <asp:Button ID="CheckBtn" runat="server" Text="查询" PostBackUrl="~/result.aspx" OnClientClick="return checkdate()" />