主题:JavaScript的onclick?
F()函数是当用户不输入用户名和密码的时候页面不会跳转,可是什么不输入,直接点击登陆,还是会跳转的。请问一下哪里出错了/
<%@ page contentType="text/html; charset=GBK" import="java.sql.*,mypro.*" %>
<html>
<head>
<script language="JavaScript" type="text/javascript" >
function f()
{
var n=document.mf.n.value;
var p=douument.mf.ps.value;
if(n=="")
return false;
if(p=="")
return false;
}
</script>
</head>
<body>
<form action="deal.jsp" name="mf" method="get">
用户名:
<input type="text" name="n" />
<br />
密码 :
<input type="password" name="ps" />
<input type="button" name="bt" value="注册" onclick="d()" />
<input type="submit" name="sb" value="登陆" onclick=" return f();"/>
<br />
</form>
</body>
<Script language="JavaScript" type="text/javascript">
function d()
{
document.location="jsp2.jsp"
}
</script>
</html>
<%@ page contentType="text/html; charset=GBK" import="java.sql.*,mypro.*" %>
<html>
<head>
<script language="JavaScript" type="text/javascript" >
function f()
{
var n=document.mf.n.value;
var p=douument.mf.ps.value;
if(n=="")
return false;
if(p=="")
return false;
}
</script>
</head>
<body>
<form action="deal.jsp" name="mf" method="get">
用户名:
<input type="text" name="n" />
<br />
密码 :
<input type="password" name="ps" />
<input type="button" name="bt" value="注册" onclick="d()" />
<input type="submit" name="sb" value="登陆" onclick=" return f();"/>
<br />
</form>
</body>
<Script language="JavaScript" type="text/javascript">
function d()
{
document.location="jsp2.jsp"
}
</script>
</html>