几种页面跳转的写法

来源:互联网 发布:sql语句多表查询count 编辑:程序博客网 时间:2024/06/07 22:26

=====javascript中弹出选择框跳转到其他页面=====
<script language="javascript">
<!--
function logout(){
if (confirm("你确定要注销身份吗?/n是-选择确定,否-选择取消")){
window.location.href="logout.asp?act=logout"
}
}
-->
</script>


=====javascript中弹出提示框跳转到其他页面=====
<script language="javascript">
<!--
function logout(){
alert("你确定要注销身份吗?");
window.location.href="logout.asp?act=logout"
}
-->
</script>

=====ASP中直接跳转到其他页面,method 1 ===========

<%
response.redirect "logont.asp"
%>

=====ASP中直接跳转到其他页面,method 2 ===========

Server.Transfer URL
这种方法也有人用,但ASP内置对象手册中好象完全没介绍到.
在网上查了一下相关资料,跟方法1大致有如下区别:
  A. 该方法只能跳转到本网站下实际存在有页面,而方法1更灵活,可跳转到其它站.
  B. 该方法是通过服务器端直接跳转的,跳转后,地址栏不会改变,容易造成假象,有什么用就不多说了.
  C. 用该方法迁移到另一个页面保持着服务资源。而不是简单的通知浏览器服务端换了个页面并迁移请求。这意味着你不需要携带更多的Http请求,因此可以减轻服务端的压力而使你的应用运行得更快。

=====ASP中直接跳转到其他页面,method 3 ===========

    Response.Status = "301 Moved Permanently"
    Response.AddHeader "Location", URL

= = = = = =PHP中跳转到其它页面 = = = = = = = = = = = = = = =

header(location:logout.php);


=====Html中确认后弹出新页面===========
function Del(id)
{
if (confirm("你确定要删除吗?"))
{
window.open("otherfile.asp?ID="+id+"&act=del","top","width=640,height=400")
}
}

=====Html中确认后跳转到其他页面=========
function Del(URL)
{
if (confirm("你确定要删除吗?"))
{
//URL="otherfile.htm"
window.location.href=URL
}
}

原创粉丝点击