我把全部代码发出来,快来人救救ME啊~~~~~
<!--#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;
}
if (document.form1.classes.value=="")
{alert ("请输入班级:");
document.form1.classes.focus();
return false;
}
if (document.form1.number.value=="")
{alert ("请输入学号:");
document.form1.number.focus();
return false;
}
document.form1.ctype.value="add";
document.form1.submit();
}
</script>
<%
if trim(request("ctype"))="add" then
student=request("student")
pwd=request("pwd")
sex=request("sex")
classes=request("classes")
number=request("number")
sqlfind="select * from student where 学号='"&trim(request("number"))&"'"
set rsfind=conn.execute (sqlfind)
if not rsfind.eof then
errmsg=errmsg&"△ 此用户名已被注册,请改名!\n"
if errmsg<>"" then
Conn.Close
Set conn = nothing
Set rsfind = nothing
response.write("<script>alert('" & errmsg & "');history.go(-1)</script>")
response.end
end if
errmsg=errmsg&"△ 请改名!\n"
response.write("<script>alert('" & errmsg & "');history.go(-1)</script>")
set rs=server.createobject("ADODB.RECORDSET")
sql="select * from student where (id is null)"
rs.open sql,conn,1,3
rs.addnew
rs("姓名")=student
rs("密码")=pwd
rs("性别")=sex
rs("班号")=classes
rs("学号")=number
rs.update %>
<script language=javascript>
alert ("成功");
</script>
<%
end if
end if%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>网上考试系统</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 24px}
-->
</style>
</head>
<body>
<p align="center" class="STYLE1"> =============<strong>学员注册</strong> ============== </p>
<form name=form1 action="">
<input type="hidden" name="ctype" />
<table width="400" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="116" height="36"> 姓 名</td>
<td width="278"> <input name="student" type="text" size="35"height="16" /></td>
</tr>
<tr>
<td height="36"> 性 别</td>
<td> <select name="sex" size="1" >
<option value="男">男</option>
<option value="女">女</option>
</select>
</td>
</tr>
<tr>
<td height="36"> 密 码</td>
<td> <input name="pwd" type="password" size="35" height="16"/></td>
</tr>
<tr>
<td height="36"> 班 号</td>
<td> <input name="classes" type="text" size="35" height="16" /></td>
</tr>
<tr>
<td height="36"> 学 号</td>
<td> <input name="number" type="text" size="35" height="16" /></td>
</tr>
<tr>
<td height="36" colspan="2" align="center"> <input type="submit" name="b1" value="提交" onClick="check()" />
<input type="reset" name="b2" value="重置" /></td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>