问一个关于response的问题
目前页面代码如下:
<!-- #include file= "conn.asp " -->
<%
dim xbpname
xbpname=request.form( "bpname ")
set rs=server.createobject( "ADODB.RECORDSET ")
sql= "select * from ptpf "
rs.open sql,conn,3,3
rs.addnew
rs( "bpname ")=xbpname
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write " <script> alert( '测评打分成功提交 ');location= ' "&request.ServerVariables( "HTTP_REFERER ")& " ' </script> "
response.end
response.redirect "pf_show.asp "
%>
问题是:现在我提交数据后,alert消息成功提示,但是 response.redirect "pf_show.asp " 该语句不执行,
我想要的效果是:提示alert消息后,将页面跳转到pf_show.asp这个页面。
------解决方案--------------------response.end '你都end 掉了,怎么执行?
response.redirect "pf_show.asp "
------解决方案--------------------去掉response.end
或者把它放于response.redirect "pf_show.asp "
之后
------解决方案-------------------- response.redirect "pf_show.asp "
response.end
------解决方案--------------------HTTP_REFERER获取上一页地址,
...location= ' "&request.ServerVariables( "HTTP_REFERER ")...
已经跳回到前一页了,你再用 response.redirect 转向就没有效果了。
当然你也可以测试一下,到底转向哪一个。
------解决方案--------------------response.write " <script> alert( '测评打分成功提交 ');this.location= 'pf_show.asp '; </script> "
response.end
------解决方案--------------------response.write " <script> alert( '测评打分成功提交 ');location= ' "&request.ServerVariables( "HTTP_REFERER ")& " ' </script> "
response.end
response.redirect "pf_show.asp "
你这样写不用response.end
你试一下这样:
<!-- #include file= "conn.asp " -->
<%
dim xbpname
xbpname=request.form( "bpname ")
set rs=server.createobject( "ADODB.RECORDSET ")
sql= "select * from ptpf "
rs.open sql,conn,3,3
rs.addnew
rs( "bpname ")=xbpname
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write " <script> alert( '测评打分成功提交 ');document.location.href= 'pf_show.asp ' </script> "
response.end
%>