---
title: "javascript跳转页面方法大全"
author: "kt431128"
date: "2014-01-03T11:40:54Z"
tags: []
categories: ["Web前端"]
slug: "javascript"
draft: false
lastmod: "2014-01-03T11:40:54Z"
id: 1998636
url: "https://kt431128.iteye.com/blog/1998636"
---

&lt;span id="tiao"&gt;3&lt;/span&gt;&lt;a href="javascript:countDown"&gt;&lt;/a&gt;n秒后自动跳转……&lt;meta http-equiv=refresh content=3;url='/search/billsearch.jsp'&lt;/ul&gt;

&lt;!--脚本开始--&gt;   
&lt;script language="javascript" type=""&gt;   
function countDown(secs){   
tiao.innerText=secs;   
if(--secs&gt;0)   
setTimeout("countDown("+secs+")",1000);   
}   
countDown(3);   
&lt;/script&gt;   
&lt;!--脚本结束--&gt;

按钮式：

　　&lt;INPUT name="pclog" type="button" value="GO" onClick="location.href='http://www.ddhbb.com/'"&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.ddhbb.com';&lt;/script&gt;

　　开新窗口：

　　&lt;a href="javascript:" onClick="window.open('http://www.ddhbb.com/blog /guestbook.asp','','height=500,width=611,scrollbars=yes,status=yes')"& gt;布丁足迹&lt;/a&gt;

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;