解决方案
js:
function dologin(){
var account = $("#ad_account").val();
if(account == ""){
alert("账号不能为空");
return false;
}
var password = $("#ad_password").val();
if(password == ""){
alert("密码不能为空");
return false;
}
<form id="loginForm" action="adminLogin.do" onsubmit="return dologin();" method="post">
<button class="logingBut" type="submit" >登录</button>
</form>
使用:οnsubmit="return dologin();
错误代码:
<form id="loginForm" action="adminLogin.do" method="post">
<button class="logingBut" type="submit" onclick="dologin()">登录</button>
</form>
详细原因:
jsreturn false失效