Web開發中常用的JavaScript實現頁面跳轉

來源:互聯網
上載者:User

按鈕式:

<INPUT name="pclog" type="button" value="/GO" onClick="location.href='http://game.unimagic.cn'">

連結式:

<a href="javascript:history.go(-1)">返回上一步</a>

<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>

直接跳轉式:

<script>window.location.href='http://game.unimagic.cn';</script>

開新視窗:

<a href="/javascript:" onClick="window.open(http://game.unimagic.cn','','height=500,width=611,scrollbars=yes,status =yes')">培訓</a>

頁面跳轉代碼集錦

1 <meta http-equiv="refresh" content="秒; url=下一個頁面">

2
<script language="JavaScript">
<!--
var userAgent = navigator.userAgent;
var MSIEIndex = userAgent.indexOf("MSIE");
if (userAgent.indexOf("Win") != -1 &&
userAgent.indexOf("MSIE") != -1 &&
userAgent.substring((MSIEIndex + 5),(MSIEIndex + 8)) >= 5.5)
window.location.replace("http://game.unimagic.cn");
//-->
</script>

沒時間轉移
3
有些人想訪問網站時,直接進入某個子目錄中的檔案,如cgi-bin/leoboard.cgi,這時,你只要寫一個預設的首頁檔案如index.htm,內容如下,就可以實現你的要求.
方法一:

<html>
<head>
<title>網頁跳轉</title>
<meta http-equiv="refresh" content="0;url=cgi-bin/leoboard.cgi">
</head>
<body>
</body>
</html>

方法二
<html>
<head>
<title>正在進入>>> Loading>>> </title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p> </p><tr> <td width=724>
<p align=center><font color="red" size="2">正在進入,請等待,謝謝......</font></p></td></tr><tr>
<td width="724">
<p align=center>
<form name=loading>
<div align=center>
<p>
<input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:rgb(124,119,119); background-color:white; padding:0px; border-style:none;">
<br><input type=text name=percent size=46 style="color:rgb(138,134,134); text-align:center; border-width:medium; border-style:none;"><script>var bar = 0
var line = "||"
var amount ="||"
count()
function count(){
bar= bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.percent.value=bar+"%"
if (bar<99)
{ setTimeout("count()",10); }
else
{ window.location = "http://game.unimagic.cn"; }
}</script>

</body>
</html>
字型:大 中 小

跳轉代碼- -

Google排名常見問題:關於頁面跳轉

SEO跳轉代碼
1:
<script language="j avascript">
location.replace("http://www.***.com")
</script>

2:
<script language="j avascript">setTimeout(window.location="http://game.unimagic.cn",0)
</script>

3:
<script language="JavaScript" >
bName = navigator.appName;
if ((bName == "Netscape") ||
(bName == "Microsoft Internet Explorer")) window.location=http://www.dinmo.net;
</script>

<FRAMESET rows='*'>
<FRAMESET cols='*'>
<FRAME SRC='http://game.unimagic.cn'>
<noframes>

JS實現跳轉代碼_多網域名稱指向同一空間

<script>try { if( self.location == "http://玉米一/" ) {
top.location.href = "http://玉米一/目錄";
}
else if( self.location == "http://玉米二/" ) {
top.location.href = "http://玉米二/目錄";
}
else if( self.location == "http://玉米三/" ) {
top.location.href = "http://玉米三/目錄";
}
else if( self.location == "http://玉米四/" ) {
top.location.href = "http://玉米四/目錄";
}
else { document.write ("錯誤的訪問地址") } } catch(e) { }</script>

 

 

 

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Loading</title>
</head>

<body>

<form name="loading">

<p align="center">正在跳轉,請稍後...</p>

<p align="center">
<input type="text" name="bar" style="border-style:none; background-color:#D3E8D0; font-weight:bold" />
<input type="text" name="percentage"style="border-style:none; background-color:#FFFFFF; max-width:30px"/>
</p>

<p align="center">
如果您的瀏覽器不支援跳轉,請點擊<a href="http://game.unimagic.cn">這裡</a>手動跳轉
</p>

<script language="javascript" type="text/javascript"> 
var percent=0;          //百分比進度,顯示在捲軸後面
var element="||";      //捲軸單元豎線
var elements="||";    //捲軸當前豎線
count();                //開始調用迴圈

function count(){ 
     percent=percent+10;    //每次百分比加10
    elements =elements + element; //捲軸當前豎線增加一個捲軸單元豎線
    document.loading.bar.value=elements;  //設定表單loading表單中bar元素的當前值
    document.loading.percentage.value=percent+"%";  //設定表單loading表單中percentage元素的當前值
    if (percent<99){                    //percent小於99則繼續迴圈
        setTimeout("count()",500);        //每500ms進行一次count()
    } 
    else{
         window.location = "http://game.unimagic.cn";    //percent達到100時跳轉
    } 
}
</script>

</form>
</body>
</html>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.