【求解】为什么onclientclick返回false还执行onclick事件?
OnClientClick="return checkuid()"
<script type="text/javascript">
function checkUID(x,y) {
var _result = false;
var _txt1 = document.getElementById("txt_username");
var _txt2 = document.getElementById("txt_pwd");
if (_txt1.value == "" && _txt2.value == "") {
alert("请输入用户名和密码");
} else {
if (_txt1.value != "" && _txt2.value == "")
{ alert("请输入密码"); }
else { _result = true; }
}
}
</script>
------解决方案--------------------<script type="text/javascript">
function checkUID(x,y) {
var _txt1 = document.getElementById("txt_username");
var _txt2 = document.getElementById("txt_pwd");
if (_txt1.value == ""
------解决方案--------------------
_txt2.value == "") {
alert("请输入用户名和密码");
return false;
}
return true;
}
</script>