注册 登录
编程论坛 ASP技术论坛

在ASP里出现的小问题。

liangfengfen 发布于 2010-08-23 20:29, 542 次点击
我在想在ASP里最提示功能,在网上查到是
response.write"<script>alert('对不起,你还未登录');</script>"
我在代码里是这么写的
if Request.Cookies("LoginInfo")<>"" then

            
            if not rs.Eof then
               Response.Redirect("collection.asp")
            else
              sql="insert into t_collection(p_code,u_code,c_time) values('" & id & "','" & cid & "',now)"
              datasource.ExecuteCommand(sql)
              set datasource = nothing
         
              Response.Redirect("collection.asp")
            end if
        else
            Response.Write"<script>alert('对不起,你还未登录');</script>"
            Response.Redirect("index.asp")

        end if
可是它运行到红色 的地方就自动跳转到index.asp 页面了。不出现提示框啊 。

[ 本帖最后由 liangfengfen 于 2010-8-23 21:49 编辑 ]
5 回复
#2
gupiao1752010-08-23 22:08
你的意思是你的代码直接进入了这个项目里?
else
            Response.Write"<script>alert('对不起,你还未登录');</script>"
            Response.Redirect("index.asp")
        end if
但是却没有执行:
Response.Write"<script>alert('对不起,你还未登录');</script>"
反而直接执行了
Response.Redirect("index.asp")
是这样吗?
#3
wangjy5002010-08-23 22:10
else
   Response.Write"<script>alert('对不起,你还未登录');</script>"
   Response.write"<script>location.href='index.asp';</script>"
end if
#4
liangfengfen2010-08-23 23:15
回复 2楼 gupiao175
hoho          就是这样的

      
#5
hams2010-08-24 08:56
不要直接用这句
Response.Redirect("index.asp")

想要跳转,先在弹出框中做个确认键。
#6
liangfengfen2010-08-24 19:46
我知道了,今天老师告诉我了

Response.Write"<script>alert('对不起,你还未登录');location.href='index.asp';</script>"
1