登陆

showtv 2007-07-05 10:27:39
请看代码

<!--#include file="conn.asp"-->
<%

select case request("action")
case "login"
strusername=request.form("CustomerEmail")
strpassword=request.form("CustomerPassword")
if strusername="" then
response.write "<Script>window.alert('Miss Username!');history.go(-1);</Script>"
else
if strpassword="" then
response.write "<Script>window.alert('Miss Password!');history.go(-1);</Script>"
else
set conn = server.createobject("adodb.connection")
set strconn=server.createobject("adodb.recordset")
strSQL="select * from CustomerProfile where CustomerEmail='"&strusername&"'"
conn.open strDS1
strconn.open strSQL, conn
if strconn.eof then
response.write "<Script>window.alert('Wrong Username!');javascript:history.back(1);</Script>"
response.end
else
if strconn("CustomerPassword")<>strpassword then
response.write "<Script>window.alert('Wrong Password!');javascript:history.back(1);</Script>"
response.end
else
session("admin")=strconn("CustomerEmail")
session("passport") = strconn("CustomerSerial")
response.redirect "CP.asp"
end if
end if
end if
end if
strconn.close
set strconn=nothing

case "logout"
session("admin")=""
response.write "<Script>window.alert('Goodbye!!!');location.replace('index.asp');</Script>"
end select

%>
<html>
<head>
<title>Login</title>
</head>
<body leftmargin=0 topmargin=100 >
<div align="center">
<table border="0" width="400" cellspacing="0" cellpadding="0" id="table1" >
<tr>
<td>
<p style="line-height: 200%" align="center"><font color="#000000">
<b>LogIn</b></font></td>
</tr>
</table>
</div>
<div align="center">
<form name=form method="post" action="LogIn.asp?action=login" >
<table border="0" width="400" cellspacing="0" cellpadding="0" id="table1" bgcolor="#FFFFFF">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="30%" align="right" class="login"><br>
<p style="line-height: 200%"><b>Username:</b></td>
<td width="70%"><br>
<p style="line-height: 200%; margin-left:20px">
<input type=text name=CustomerEmail size=20 class="input"></td>
</tr>
<tr>
<td width="30%" align="right" class="login"><br>
<p style="line-height: 200%"><b>Password:</b></td>
<td width="70%"><br>
<p style="line-height: 200%; margin-left:20px">
<input type=password name=CustomerPassword size=20 class="input"></td>
</tr>
<tr>
<td colspan="2"><br>
<p align="center" style="line-height: 200%">
<input value="Log In" name="LogIn" type="submit" class="submit"></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table></form>
</div>
</body>
</html>

这个能正常登陆,我想实现的是,当出现错误信息的时候不是出现对话框,而是在LOGIN下面出现相关的错误信息文字,请问该怎么做?谢谢
...全文
165 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
huo789 2007-07-05
  • 打赏
  • 举报
回复
传递Url参数到你的登录页面,在登录页面获得这些信息
如出现错误信息时:
Response.Redirection("login.asp?errMsg=没有此用户")
在login.asp开始时判断
Dim errMsg
errMsg = Request.QueryString("errMsg")
If errMsg <> "" then
response.write errMsg
End If
angelhualing 2007-07-05
  • 打赏
  • 举报
回复
login下面搞一个显示错误信息的表格<tr><td id="err_message"></td></tr>
把弹出错误信息<Script>window.alert('Miss Username!');history.go(-1);</Script>这些改成
<script>document.getElementById("err_message").innerHTML="Miss Uername!";</script>
showtv 2007-07-05
  • 打赏
  • 举报
回复
你的也不对,也出现类似的错误,AJAX不会用
ld2099 2007-07-05
  • 打赏
  • 举报
回复
或者使用Ajax
ld2099 2007-07-05
  • 打赏
  • 举报
回复
当然错误了,没有返回页面,也没有那个ID标签

应该是:
login下面搞一个显示错误信息的表格<tr><td id="err_message"></td></tr>
把弹出错误信息<Script>window.alert('Miss Username!');history.go(-1);</Script>这些改成
<script>history.go(-1);document.getElementById("err_message").innerHTML="Miss Uername!";</script>
showtv 2007-07-05
  • 打赏
  • 举报
回复
上面的第一中方法不对,提示出现错误

28,404

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧