如何自动跳转到指定页面?

daqi2010 2009-09-29 05:16:42
<%
id=request.querystring("id")
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from product where id="&id
rs.open sql,conn,1,2
sort_name=rs("sort_name")
--------------------
If sort_name="电器" Then
response.redirect "dq/show.asp?id=id"
End if
If sort_name="手机" Then
response.redirect "sj/show.asp?id=id"
End if
--------
rs.close
set rs=nothing
%>
跟据ID得到商品的类型,然后跟据类型跳转到不同的页面?
谢谢大家
...全文
98 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hgc8888 2009-09-29
  • 打赏
  • 举报
回复
VBSCRIPT用:response.redirect "跳转页"
JAVASCRIPT用:location href "跳转页"
也可以在网页头部的:<meta http-equiv="refresh" content="1;URL=/">
yunxiang2005 2009-09-29
  • 打赏
  • 举报
回复
你把这两句改成下面这样就行了。response.redirect "dq/show.asp?id=id" 和response.redirect "sj/show.asp?id=id" 这两句改成下面这样:
response.redirect "dq/show.asp?id=" & id
response.redirect "sj/show.asp?id=" & id
owenzhang 2009-09-29
  • 打赏
  • 举报
回复
response.redirect
window.location.href
hookee 2009-09-29
  • 打赏
  • 举报
回复

<%
id = request.querystring("id")
Set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from product where id=" & id
rs.open sql,conn,1,1
If Not (rs.EOF And rs.BOF) Then
sort_name = Trim(rs("sort_name"))
End If
rs.close
set rs = nothing
conn.Close
set conn = nothing

url = ""
Select Case sort_name
Case "电器" url = "dq/show.asp?id=" & id
Case "手机" url = "sj/show.asp?id=" & id
End Select
Response.Redirect url
%>
西安风影 2009-09-29
  • 打赏
  • 举报
回复
你的代码不对吗?

28,390

社区成员

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

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