以下是我登录的一小段代码,我想问一下,为什么我什么都不填写,一点击确定,页面提示未写用户名之后页面自动跳转到下一页了,本应该还是在本页继续填写的啊?请高手指教
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>登录</title>
<script language="javascript"> function mycheck(){
if(document.form.name.value=="")
{
alert("请填写姓名");
return;
}
if(document.form.pswd.value=="")
{
alert("请填写密码");
return;
}
document.form.submit();
}
</script>
</head>
<body>
<form name="form" action="testlogin.jsp" method="post">
请输入姓名:
<input type="text" name="name"><br>
密码 :
<input type="password" name="pswd"><br>
<input type="submit" value="提交" onclick="mycheck()">
<input type="reset" value="重填">
</form>
</body>
</html>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>登录</title>
<script language="javascript"> function mycheck(){
if(document.form.name.value=="")
{
alert("请填写姓名");
return;
}
if(document.form.pswd.value=="")
{
alert("请填写密码");
return;
}
document.form.submit();
}
</script>
</head>
<body>
<form name="form" action="testlogin.jsp" method="post">
请输入姓名:
<input type="text" name="name"><br>
密码 :
<input type="password" name="pswd"><br>
<input type="submit" value="提交" onclick="mycheck()">
<input type="reset" value="重填">
</form>
</body>
</html>
解决方案 »
- 求大侠帮助 谢谢
- java代码创建ORALCE用户,并附权限
- JXL读取Excel表格,再由Jdom转换为XML文件出错问题~急!!
- 这个效果是怎么做出来的?
- jspsmartupload怎么下载中文文件,上传时怎么重命名啊?
- 请问用jsp如何实现发送邮件时“增加附件”和“删除附件”这样的功能???
- 还没开始就已经结束的盛宴
- 小弟才浅,上网看到一个源码,叫××JSP探针不知何物?望高手回答,立刻给分!
- 如何获取文档内容
- 请问:谁有“web报表打印”的源代码?请共享一下。谢谢啦
- 铃声下载网站的详解
- Help me!The URIEncoding has been changed to UTF-8,but it couldn't support Chinese code all the same!
if(document.form.name.value=="")
{
alert("请填写姓名");return false;
}if(document.form.pswd.value=="")
{
alert("请填写密码");return false;
}
document.form.submit();}
<html>
<head>
<title>登录</title>
<script language="javascript">function mycheck(){
if(document.form.name.value=="")
{
alert("请填写姓名");return false;
}if(document.form.pswd.value=="")
{
alert("请填写密码");return false;
}
document.form.submit();}</script>
</head>
<body>
<form name="form" action="testlogin.jsp" method="post">
请输入姓名:
<input type="text" name="name"><br>
密码 :
<input type="password" name="pswd"><br>
<input type="button" value="提交" onclick="mycheck()">
<input type="reset" value="重填">
</form></body>
</html>
submit是提交按钮
reset是重置按钮