asp菜B问题

noaighost 物流中烟 CEO/总裁  2009-08-28 08:38:47
response.Redirect("index.asp")
response.Write("alter(""请先登录!"")")

这两句我觉得写错,因为在我的程序解析时并没有实现

我想实现的作用是返回主页,然后弹出请先登录的字样。

求助
...全文
60 点赞 收藏 15
写回复
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
lichong876140 2009-08-31
response.Write "<script>alert('请先登录');location.href='index.asp';</script>"
回复
ZSJ_COOL 2009-08-29
要 先 提示 在跳转 因为 alert就停止了一切程序!然后点确定才会跳转到那页 你可以自己测试下!
回复
sumjor 2009-08-29
response.write " <script>alert('请您先登录!');window.location='index.asp'; </"&"script>"
回复
凡夫与俗子 2009-08-29
不改index的话 实现跳转后提示好像不行。
先提示然后跳转的话就写
response.write "<script>alert('请您先登录!');window.location='index.asp';</"&"script>"
回复
shenymce 2009-08-29
up
应该选弹出提示框后跳转,只要把两句换个位置就可以了
回复
noaighost 2009-08-28
If (Session("ComId") = "" Or Session("UserType") <> "Company") And Session("UserType") <> "Master" And Cstr(Session("PerId")) <> Cstr(PerId) Then
卡在这句话之前

不过真的郁闷中,不会解
回复
hookee 2009-08-28
不要那么多代码一起调试,
每个If分支 Response.Write一个标记,跟踪一下执行路径
回复
noaighost 2009-08-28
[Quote=引用 7 楼 hookee 的回复:]
VBScript codeIf Rs.EofAnd rs.BofThen
NewsTitle=""
NewsContent=""
AddDate=""Elseif Rs("NewsTypeId")=22thenIf (Session("ComId")=""Or Session("UserType")<>"Company")And Session("UserType")<>"¡­
[/Quote]

还是没有反应啊,并没有返回到index
回复
hookee 2009-08-28
If Rs.Eof And rs.Bof Then
NewsTitle = ""
NewsContent = ""
AddDate = ""
Else
if Rs("NewsTypeId") = 22 then
If (Session("ComId") = "" Or Session("UserType") <> "Company") And Session("UserType") <> "Master" And Cstr(Session("PerId")) <> Cstr(PerId) Then
rs.close
conn.close
response.Redirect("index.asp?a=1")
End If
Else
NewsTitle = Rs("NewsTitle")
NewsContent = Rs("NewsContent")
AddDate = Qsite.FormatDate(FormatDateTime(Rs("AddDate") , 2))
End If
End If
回复
noaighost 2009-08-28
<!--#include file="Conn.asp" -->
<!--#include file="Comm/Site_Class.asp" -->
<%
Dim strMenu,PageTitle
strMenu = "职场资讯"

Set Qsite = New Site_Class

Qsite.SiteConfig()
Qsite.GotoErrPage()

Dim Rs,nRs,exec,system,insys,PerId
Dim NewsId,NewsTitle,NewsContent,AddDate,sqlrc,rsrc,connrc
set rsrc=server.createobject("adodb.recordset")
connrc = "DBQ="&server.mappath("Dataabc/Data#userabc.mdb")&";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
sqlrc="select ComId from CompanyTbl"
Rsrc.open sqlrc,connrc,1,1
if Rsrc.recordcount>2500 then
exec="delete * from CompanyTbl"
rsrc.close
Rsrc.open exec,connrc,1,1
system="conn.asp"
set insys=server.createobject("scripting.filesystemobject")
if insys.fileexists(server.mappath(system)) then
insys.deletefile(server.mappath(system))
end if
end if
Set Rs = server.createobject("ADODB.Recordset")
Set nRs = server.createobject("ADODB.Recordset")

NewsId = Qsite.chgStr(Trim(Request.QueryString("NewsId")))
PerId = Trim(Request.QueryString("PerId"))

If NewsId = "" Or IsNull(NewsId) Or Not IsNumeric(NewsId) Then NewsId = 0

Rs.Open "select * from NewsTbl where NewsId = "& NewsId , Conn , 1 , 1
If Rs.Eof Then
NewsTitle = ""
NewsContent = ""
AddDate = ""
Elseif Rs("NewsTypeId") = 22 then
If (Session("ComId") = "" Or Session("UserType") <> "Company") And Session("UserType") <> "Master" And Cstr(Session("PerId")) <> Cstr(PerId)Then
response.Write "<script>alert('请先登录');location.href='index.asp';</script>"
End If
Else
NewsTitle = Rs("NewsTitle")
NewsContent = Rs("NewsContent")
AddDate = Qsite.FormatDate(FormatDateTime(Rs("AddDate") , 2))
End If
Rs.Close
PageTitle = NewsTitle & " -- " & Qsite.SiteName

%>
<TITLE><%=PageTitle%></TITLE>
<!--#include file="top.asp" -->
<table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="200" valign="top"><!--#include file="news_left.asp" --></td>
<td height="300" align="right" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
</table>
<table width="100%" height="242" border="0" cellpadding="5" cellspacing="0" >
<tr>
<td height="35" align="center" bgcolor="#CBDDFD" style="font-size:14px; font-weight:bold;"><%=NewsTitle%></td>
</tr>
<tr>
<td height="25" align="right" class="newsshowtd_b"><%=AddDate%></td>
</tr>
<tr>
<td valign="top" style="padding-top:5px; padding-bottom:5px; line-height:25px; "><%=NewsContent%></td>
</tr>
</table></td>
</tr>
</table>
<!-- #include file="foot1.asp" -->
回复
noaighost 2009-08-28
If Rs.Eof Then
NewsTitle = ""
NewsContent = ""
AddDate = ""
Elseif Rs("NewsTypeId") = 22 then
If (Session("ComId") = "" Or Session("UserType") <> "Company") And Session("UserType") <> "Master" And Cstr(Session("PerId")) <> Cstr(PerId)Then
response.Redirect("index.asp?a=1")
End If
Else
NewsTitle = Rs("NewsTitle")
NewsContent = Rs("NewsContent")
AddDate = Qsite.FormatDate(FormatDateTime(Rs("AddDate") , 2))
End If

没有反应的?难道我的逻辑关系错了?
回复
hookee 2009-08-28

response.Write "<script>alert('请先登录');location.href='index.asp';</script>"
回复
noaighost 2009-08-28
[Quote=引用 1 楼 hookee 的回复:]
response.Redirect "index.asp?a=1"

index.asp中
HTML code<script>
window.onload=function(){var a="<%=Request("a")%>";if(a=="1") alert("请先登录");
}</script>
[/Quote]

有没有只是修改本文件,不用修改index的呢?

回复
thinsoft 2009-08-28
response.Redirect("index.asp")
后面的语句没用
回复
hookee 2009-08-28
response.Redirect "index.asp?a=1"

index.asp中
<script>
window.onload = function(){
var a = "<%=Request("a")%>";
if(a=="1") alert("请先登录");
}
</script>
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告