---
title: "JS跳转页面参考代码大全"
author: "bobshute"
date: "2009-04-07T22:24:03Z"
tags: ["ASP", "Go", "JSP", "JavaScript"]
slug: "js"
draft: false
lastmod: "2009-04-07T22:24:03Z"
id: 363056
url: "https://bobshute.iteye.com/blog/363056"
---

JS跳转页面参考代码  
第一种：      
&lt;script language="javascript" type="text/javascript"&gt;  
window.location.href="login.jsp?backurl="+window.location.href;  
&lt;/script&gt;  
第二种：      
&lt;script language="javascript"&gt;  
alert("返回");  
window.history.back(-1);     
&lt;/script&gt;  
第三种：     
&lt;script language="javascript"&gt;  
window.navigate("top.jsp");    
&lt;/script&gt;  
第四种：     
&lt;script language="JavaScript"&gt;            
self.location=’top.htm’;     
&lt;/script&gt;  
第五种：     
&lt;script language="javascript"&gt;            
alert("非法访问！");            
top.location=’xx.jsp’;     
&lt;/script&gt;

＝＝＝＝＝javascript中弹出选择框跳转到其他页面＝＝＝＝＝  
&lt;script language="javascript"&gt;  
&lt;!--  
function logout()...{  
if (confirm("你确定要注销身份吗？是－选择确定，否-选择取消"))...{  
window.location.href="logout.asp?act=logout"  
}  
}  
\--&gt;  
&lt;/script&gt;

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

=================================  
按钮式：  
&lt;INPUT name="pclog" type="button" value="GO" onClick="location.href='http://www.51wisdom.com.cn/'"&gt;

　　链接式：

　　&lt;a href="javascript:history.go(-1)"&gt;返回上一步&lt;/a&gt;

　　&lt;a href="&lt;%=Request.ServerVariables("HTTP\_REFERER")%&gt;"&gt;返回上一步&lt;/a&gt;

　　直接跳转式：

　　&lt;script&gt;window.location.href='http://www.51wisdom.com.cn/';&lt;/script&gt;

　　开新窗口：

　　&lt;a href="javascript:" onClick="window.open(http://www.51wisdom.com.cn/','','height=500,width=611,scrollbars=yes,status=yes')"&gt;杭&lt;/a&gt;