-------------------------------下面是登陆页面--------------------------------------
<!--#include file="conn.asp"-->
<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!--
function login(){
if(document.login1.u.value=="" || document.login1.p.value==""){
alert("用户名或密码不能为空");
return false;
}
}
//-->
</script>
<title>登陆页面</title>
</head>
<body>
<table width="600" height="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="300" height="60" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><form name="login1" method="post" action="check.asp">
<label>用户名:
<input name="u" type="text" size="20" height="15" />
</label>
<br>
<label>密 码:
<input name="p" type="password" size="20" height="15" />
</label>
<label> <br>
<input name="Submit" type="Submit" value="登陆" onClick="JavaScript:return login();" />
</label>
<label>
<input type="reset" name="Submit2" value="清除" />
</label>
<label>
<input type="button" name="Submit3" onClick="javascript:window.opener=null;window.close()" value="退出" />
</label>
</form></td>
</tr>
</table>
</body>
</html>
------------------------下面是cheak.asp-------------------------
<!--#include file="conn.asp"-->
<%
User=Request.form("u")
Pwd=Request.form("p")
Set Rs=Server.Createobject("adodb.recordset")
Sql="select * from Student where userName='"&User&"' and password='"&Pwd&"'"
Rs.open Sql,conn,1,1
If Rs.Bof and Rs.eof then
Response.write "<script language=javascript>alert('用户不存在');history.go(-1);</script>"
Response.End
Elseif Rs("password")<>Pwd then
Response.write "<script language=javascript>alert('密码错误');history.go(-1);</script>"
Response.End
Else
Session("userName")=User
Response.redirect("index.asp")
End if
%>
------------------------------------------------------------------------------------
怎么老是提示用户不存在....我可是看着自己的数据库打的..Student是表..userName列名...password列名...