你换成这样吧
<input type="button" value="确定" name="Submit" onclick="check()">
<input type="button" value="确定" name="Submit" onclick="check()">
解决方案 »
- 怎样用Java写一个过滤器?
- 怎么在JSP页面上加树?
- eWebEditor在线文本编辑器吕海鹏修改版v0.1.3的问题
- saveErrors()是干什么的,有什么作用,必须吗?
- 使用ENCTYPE="multipart/form-data"提交后的处理页面如何返回值给原页面
- 关于servlet的问题
- jbuilder x+weblogic 8.1+struts时要不要配置环境变量,请高手们尽快帮忙解决
- ASP.NET和JSP之间我究竟应该选择谁?
- 我的servlet为什么总是运行不了?
- n简单的问题,怎么不相等哪?(jsp)
- 用 Resin 怎么配置运行 Servlet 程序?
- jsp如何实现刷新某页???
<html><head>
<script language="JavaScript">
function IsEmpty(str)
{
if((str==null)||(str.length==0)) { return true; }
else { return false; }
}
function check()
{
var NickName=window.document.login_form.NickName.value;
alert(NickName);
if(NickName=="")
{
alert("请输入姓名!");
window.document.login_form.NickName.focus();
return false;
}
var PWD=window.document.login_form.PWD.value;
if(PWD=="")
{
alert("请输入正确登陆密码!");
window.document.login_form.PWD.focus();
return false;
}
return true;
}
</script>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" href="inc/style.css" type="text/css">
<title>用户登陆</title>
</head><body><form name="login_form" method="post" action="login.jsp" onsubmit="return check()">
<input type="text" name="NickName" size="16"><br>
<input type="password" name="PWD" size="16"><br>
<input type="submit" value="确定" name="Submit"><input type="reset" value="重写" name="Reset">
</form></body></html>
onsubmit="javascript:return check()"
这一句没错,不过没就算验证失败也会进入你所指定的页面,所以改成
onsubmit="return check()"就可以了。
我怎么连个<%号都没看到???