新微赢技术网

标题: [求助]表单没有被提交 [打印本页]

作者: first    时间: 2010-1-8 00:57
标题: [求助]表单没有被提交
<!--#include file="conn.asp"-->
<script language=javascript>
function check()
{if(document.form1.student.value=="")
{alert("请输入用户名");
document.form1.student.focus();
return false;}
if(document.form1.pwd.value=="")
{alert("请输入用户密码");
document.form1.pwd.focus();
return false;}
document.form1.ctype.vlaue="add";
document.form1.submit();
}
</script>
<%
session.Timeout=125
if trim(request("ctype"))="add" then
session("student")=""
session("classes")=""
session("id")=""
session("number")=""
session("sex")=""
sql="select * from student where studentname='"&trim(request("student"))&"' and studentpassword='"&trim(request("pwd"))&"'"
set rs=conn.execute(sql)
if rs.eof then
%>
<script language=javascript>
alert("无此学员!请先注册");
</script>
<%
else
session("student")=rs("studentname")
session("classes")=rs("class")
session("number")=rs("studentnumber")
session("sex")=rs("sex")
session("timer")=now
%>
<script language=javascript>
var now=new date()
window.navigata("index.asp?time="+now.getTime());
</script>
<% end if
end if %>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网上考试系统</title>
<link rel="stylesheet" type="text/css" href="css.css">
<style type ="text/css">
<!-
a{text-decoration:none}
a:link{text-decoration:none}
a:hover{text-decoration:none}
a:visited{text-decoration:none}
->
</style>
</head>
<body>
<!--#include file="top.htm"-->
<table border="0" cellpadding="4" style="border-collapse: collapse" bordercolor="#111111" width="778" height="100">
<tr>
<td align="center">
<table border="0" width="100%" id="table1">
<tr>
<td> </td>
<td>
<form name=form1 action=""> <input type="hidden" name="ctype">
<table border="0" bordercolor="#111111" width="778" height="100">
<tr>
<td align="center">
<table border="0" width="100%">
<table border="0" width="300" >
<tr>
<td width="100" align="right">用户名:</td>
<td width="200">
<input type="text" name="student" size="20"></td></tr>
<tr>
<td width="100" align="right">密码:</td>
<td width="200">
<input type="password" name="pwd" size="20"></td></tr>
<tr align="center">
<td align="center"><input type="button" value="提交" name="b1" onclick="check()">
<input type="reset" value="重置" name="b2" ></td></tr>
<tr >
<td width="400"><a href="register.asp">新学生注册</a></td></tr>
<tr>
<td><a href="admin/index.asp">后台管理入口</a></td>
<td width="299" height="289"><img border="0" src="images/web213.jpg"></td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>
不知道哪里出错了,没有"请输入用户名"的提示?
作者: 发指的青春    时间: 2010-1-8 00:57
非常感谢,找到原因了,是"("请输入用户密码");"右括号的问题
作者: √sdf    时间: 2010-1-8 00:58
  1. <script language=javascript>
  2. function check(){
  3. if(document.form1.student.value==""){
  4. alert("请输入用户名");
  5. document.form1.student.focus();
  6. }
  7. if(document.form1.pwd.value==""){
  8. alert("请输入用户密码");
  9. document.form1.pwd.focus();
  10. }
  11. document.form1.ctype.vlaue="add";
  12. document.form1.submit();
  13. }
  14. </script>
  15. <form name=form1 action="">
  16. <input type="hidden" name="ctype">
  17. <input type="text" name="student" size="20">
  18. <input type="password" name="pwd" size="20">
  19. <input type="button" value="提交" name="b1" onclick="check()">
  20. <input type="reset" value="重置" name="b2" >
  21. </form>
复制代码

没问题啊




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2