我一直是用一个页面完成的
看看吧
aaa.asp
<%
userName=trim(Request("userName"))
userpwd=trim(Request("userpwd"))
css=trim(Request("css"))
if css="1" then
response.Write "<script language='vbscript'>"
response.Write "msgbox " & chr(34) & "帐号未输入" & chr(34)
response.Write "</script>"
end if
if css="2" then
response.Write "<script language='vbscript'>"
response.Write "msgbox " & chr(34) & "密码未输入" & chr(34)
response.Write "</script>"
end if
if css="3" then
执行操作
end if
if username="" then
Response.Redirect "aaa.asp?css=1"
end if
if userpwd="" then
Response.Redirect "aaa.asp?css=2"
end if
if userName<>"" and userpwd<>"" then
Response.Redirect "aaa.asp?css=3"
end if
%>
<form id="form1" name="form1" action="aaa.asp">
<input id="userNam" name="userName">
<input type="password" id="userpwd" name="userpwd">
</form>
我给你看看现在的代码吧,我也是粗粗把两个页面的内容结合起来
<!--#include file="conn.asp"-->
<%
id = request("num")
password = request("passwd")
if id = "" then
conn.close
set conn = nothing
response.write "<script>alert('请选择您的姓名');window.location.href='main.asp';</script>"///????/?原来是两个页面,所以用这句话
response.end
end if
if password = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入密码');window.location.href='main.asp';</script>"////??如何返回当前页面
response.end
end if
sql = "select * from student where num='"&id&"'"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.recordcount < 1 then
rs.close
set rs = nothing
conn.close
set conn = nothing
response.write "<script>alert('学号输入错误,没有该学生');history.go(-1);</script>"
else
if password = rs("passwd") then
session("num") = rs("num")
rs.close
set rs = nothing
conn.close
set conn = nothing
'response.redirect "zytm1.asp"
response.write "<script>window.location.href='zytm1.asp';</script>"
else
rs.close
set rs = nothing
conn.close
set conn = nothing
response.write "<script>alert('密码错误');window.location.href='main.asp';</script>"
end if
end if
%>
<html>
<head>
<base target="rbottom">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<center>
(注:用户名为学生学号,初始密码与学号相同,请登录后自行修改!)
</p></center>
<%else
sql = "select name from student where num='"&session("num")&"'"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<div align="center">欢迎 <font color=#FF0000 size=6><%=rs("name")%></font> 同学回来
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>