網(wǎng)頁(yè)跳轉(zhuǎn)方法大集合 <一>三種網(wǎng)頁(yè)跳轉(zhuǎn)代碼: 如果你要在服務(wù)器端跳轉(zhuǎn),可以這樣:
Response.Redirect(www.77ya.com) Response.End
如果你要在客戶(hù)端跳轉(zhuǎn),可以這樣:
<script language="javascript" type="text/javascript"> window.location="http: //www.77ya.com";; </script>
如果你要讓頁(yè)面顯示幾秒鐘之后跳轉(zhuǎn),可以在html代碼的<head></head>部分加上這樣的代碼:
<meta http-equiv="refresh" content="3; url=http://www.77ya.com"> (3秒鐘后自動(dòng)跳轉(zhuǎn)到www.77ya.com)
以上三種是也比較常見(jiàn),比較常用的網(wǎng)頁(yè)跳轉(zhuǎn)代碼運(yùn)行平臺(tái)Win9x WinNT Win2000 WinME WinXP。
<二>
幾段簡(jiǎn)單的網(wǎng)頁(yè)跳轉(zhuǎn)代碼 不隱藏轉(zhuǎn)向之后的地址 代碼一: <html> <body> <form name=loading> <P align=center><FONT face=Arial color=#0066ff size=2>loading...</FONT> <INPUT style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-WEIGHT: bolder; PADDING-BOTTOM: 0px; COLOR: #0066ff; BORDER-TOP-style: none; PADDING-TOP: 0px; FONT-FAMILY: Arial; BORDER-RIGHT-style: none; BORDER-LEFT-style: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-style: none" size=46 name=chart> <INPUT style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; COLOR: #0066ff; BORDER-BOTTOM: medium none; TEXT-ALIGN: center" size=47 name=percent> <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()",100);} else {window.location = "將這里改成要轉(zhuǎn)入的網(wǎng)址";} }</SCRIPT>
</form> </body> </html> 不隱藏轉(zhuǎn)向之后的地址 代碼二: <html> <body> <script language="javascript"> <!-- function goToURL() { //v2.0 for (var i=0; i< (goToURL.arguments.length - 1); i+=2) //with arg pairs eval(goToURL.arguments+".location=''"+goToURL.arguments[i+1]+"''"); document.returnvalue = false; } //--> </script> <body bgcolor="#FFFFFF" onLoad="goToURL(''parent'',''將這里改成要轉(zhuǎn)入的網(wǎng)址'');return document.returnvalue"> </body> </html> 不隱藏轉(zhuǎn)向之后的地址 代碼三: <html> <SCRIPT LANGUAGE="javascript"> <!-- Start Code var ver = navigator.appVersion; if (ver.indexOf("MSIE") != -1) { window.location.href="將這里改成要轉(zhuǎn)入的網(wǎng)址" }else window.location.href="將這里改成要轉(zhuǎn)入的網(wǎng)址" // End Code --> </SCRIPT> </html> 不隱藏轉(zhuǎn)向之后的地址 代碼四: <html> <body> <meta http-equiv="refresh" content="0.1;url=將這里改成要轉(zhuǎn)入的網(wǎng)址"> </body> </html> 可隱藏轉(zhuǎn)向之后的地址: <html> <frameset framespacing="0" border="0" rows="0" frameborder="0"> <frame name="main" src="將這里改成要轉(zhuǎn)入的網(wǎng)址" scrolling="auto" noresize> </frameset> </html> <三> 網(wǎng)頁(yè)跳轉(zhuǎn)
<meta http-equiv="refresh" content="3;rul=跳轉(zhuǎn)的網(wǎng)頁(yè)">
此代碼可以讓網(wǎng)頁(yè)在一定的時(shí)間內(nèi),跳轉(zhuǎn)到另外一個(gè)網(wǎng)頁(yè)上,其中content=" 為跳轉(zhuǎn)前停暫的秒數(shù),rul= 為跳轉(zhuǎn)的網(wǎng)址
<meta http-equiv="refresh" content="3;rul=跳轉(zhuǎn)的網(wǎng)頁(yè)">
此代碼可以讓網(wǎng)頁(yè)在一定的時(shí)間內(nèi),跳轉(zhuǎn)到另外一個(gè)網(wǎng)絡(luò)推廣的網(wǎng)頁(yè)上,其中content=" 為跳轉(zhuǎn)前停暫的秒數(shù),rul= 為跳轉(zhuǎn)的網(wǎng)址
===================================================================
<html> <head> <title>網(wǎng)頁(yè)跳轉(zhuǎn)</title> <meta http-equiv="refresh" content="0;url=cgi-bin/leoboard.cgi"> </head> <body> </body> </html> =================================================================== 1,頁(yè)面自動(dòng)刷新:把如下代碼加入<head>區(qū)域中<meta http-equiv="refresh" content="20">,其中20指每隔20秒刷新一次頁(yè)面.
2,頁(yè)面自動(dòng)跳轉(zhuǎn):把如下代碼加入<head>區(qū)域中<meta http-equiv="refresh" content="20;url=http://www.njcatv.net">,其中20指隔20秒后跳轉(zhuǎn)到http://www.njcatv.net頁(yè)面。
=================================================================== <html> <head> <title>正在進(jìn)入>>> Loading>>> </title> </head> <body bgcolor="#FFFFFF" text="#000000"> <p> </p><tr> <td width=724> <p align=center><font color="red" size="2">正在進(jìn)入,請(qǐng)等待,謝謝......</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://www.wwwfox.net/cgi-bin/leoboard.cgi";} }</script>
</body> </html>
=================================================================== 如果要cgi的文件,可以用以下方式:
#!/usr/bin/perl
print "Content-type:text/html ";
print<<END;
<html> <head> <title>正在進(jìn)入 http://bbs.wwwfox.net >>> Loading>>> </title> </head> <body bgcolor="#FFFFFF" text="#000000"> <p> </p><tr> <td width=724> <p align=center> </p> <p align=center><b><font size="6">論壇新地址:</font><font color="red" size="6"> http://bbs.wwwfox.net !</font></b></p> <p align=center><b><font size="6">正在進(jìn)入,請(qǐng)等待,謝謝......</font></b></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://bbs.wwwfox.net/cgi-bin/leoboard.cgi";} }</script>
</body> </html>
END
exit;
=================================================================== 以 htm 可以用以下方式: <html> <body> <script language='javascript'>document.location= 'http://l39.net/lb5000/leoboard.cgi'</script> </body> </html>
以 asp 可以用以下方式:
<%
response.redirect "http://l39.net/lb5000/leoboard.cgi"
%> <四>1. 在<head></head>區(qū)域加入 代碼: <meta http-equiv=Pragma content=no-cache> <Meta http-equiv="refresh" content="3;url='http://hztv.com.ru' ">
2. JavaScript 代碼: <SCRIPT LANGUAGE="JavaScript">
<!-- Begin redirTime = "3000"; redirURL = "http://hztv.com.ru/"; function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); } // End --> </script>
<body onLoad="redirTimer()">
3. JavaScript 代碼: <html><head><title>稍候。。。</title></head> <body> <script language='javascript'>document.location = '跳轉(zhuǎn)地址'</script> </body> </html>
4. 帶進(jìn)度條的頁(yè)面跳轉(zhuǎn)代碼 代碼: <html> <head> <meta http-equiv="Content-Language" content="zh-cn"> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"> <title>新視聽(tīng)資源共享論壇</title> </head> <body> <form name=loading> <P align=center><FONT face=Arial color=#0066ff size=2>loading...</FONT> <INPUT style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-WEIGHT: bolder; PADDING-BOTTOM: 0px; COLOR: #0066ff; BORDER-TOP-style: none; PADDING-TOP: 0px; FONT-FAMILY: Arial; BORDER-RIGHT-style: none; BORDER-LEFT-style: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-style: none" size=46 name=chart> <INPUT style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; COLOR: #0066ff; BORDER-BOTTOM: medium none; TEXT-ALIGN: center" size=47 name=percent> <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()",100);} else {window.location = "http://www.myand.com/";} }</SCRIPT>
</form> </body> </html>
<五> 網(wǎng)頁(yè)跳轉(zhuǎn)方法+代碼
1. window.location <body onload=window.location="http://www.***.com(請(qǐng)換成你的網(wǎng)址)"></body> 或(此法應(yīng)用范圍較廣,并可應(yīng)用在一般后臺(tái)編輯器中) <script>window.location="<A href='http://xxx"http://xxx"</script> 2. META標(biāo)志 <META HTTP-EQUIV=refresh content="0; url=http://www.***.com(請(qǐng)換成你的網(wǎng)址)"> //其中content后面的阿拉伯?dāng)?shù)字是代表過(guò)幾秒中鐘轉(zhuǎn)入目標(biāo)網(wǎng)頁(yè)。 3. 利用框架隱藏轉(zhuǎn)向地址(此方法不便用 dreamweaver 編輯,請(qǐng)使用記事本或其他文本編輯器處理) <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>知覓__朱高站</title> </head> <frameset rows="*,0" frameborder="no" border="0" framespacing="0"> <frame src="http://www.***.com(請(qǐng)換成你的網(wǎng)址)" name="mainFrame" id="mainFrame"> <frame src="" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame"> </frameset> <noframes> <body> 請(qǐng)用IE瀏覽 </body> </noframes> </html>
<六><html> <head> <title>頁(yè)面跳轉(zhuǎn)</title> <meta http-equiv="refresh" content="3;url=http://hi.baidu.com/cnredflag"> </head> <body> 此頁(yè)面三秒后跳轉(zhuǎn)到http://hi.baidu.com/cnredflag </body> </html>
<七>html中跳轉(zhuǎn)最全代碼
程序代碼
<html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>正在進(jìn)入</title> </head> <body> <form name=loading> <p align=center> <font color="#0066ff" size="2">正在進(jìn)入,請(qǐng)稍等</font><font color="#0066ff" size="2" face="Arial">...</font> <input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:#0066ff; background-color:#fef4d9; padding:0px; border-style:none;"> <input type=text name=percent size=47 style="color:#0066ff; 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()",100);} else {window.location = "http://blog.gangege.com";} }</script> </p> </form> <p align="center"> 如果您的瀏覽器不支持跳轉(zhuǎn),<a style="text-decoration: none" href=" color="#FF0000">請(qǐng)點(diǎn)這里</font></a>.</p> </body> </html>
一個(gè)彈出窗口的代碼
<SCRIPT LANGUAGE="javascript"> window.open ('http://www.086city.com/ads/index.html', 'newwindow', 'height=400, width=500, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')</SCRIPT>
浮動(dòng)廣告代碼
<SCRIPT> var imagepath="http://www.baidu.com/img/logo.gif" //這里是浮動(dòng)圖片的地址 var imagewidth=171 //這兩行寫(xiě)圖片的大小 var imageheight=133 var speed=3; var imageclick="http://www.SZ800.com/" //這里寫(xiě)點(diǎn)擊圖片連接到的地址 var hideafter=0 var isie=0; if(window.navigator.appName=="Microsoft Internet Explorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE")+5,window.navigator.appVersion.indexOf("MSIE")+8)>=5.5) { isie=1; } else { isie=0; } if(isie){ var preloadit=new Image() preloadit.src=imagepath } function pop() { if(isie) { x=x+dx;y=y+dy; oPopup.show(x, y, imagewidth, imageheight); if(x+imagewidth+5>screen.width) dx=-dx; if(y+imageheight+5>screen.height) dy=-dy; if(x<0) dx=-dx; if(y<0) dy=-dy; startani=setTimeout("pop();",50); } } function dismisspopup(){ clearTimeout(startani) oPopup.hide() } function dowhat(){ if (imageclick=="dismiss") dismisspopup() else window.open(imageclick); } if(isie) { var x=0,y=0,dx=speed,dy=speed; var oPopup = window.createPopup(); var oPopupBody = oPopup.document.body; oPopupBody.style.cursor="hand" oPopupBody.innerHTML = '<IMG SRC="'+preloadit.src+'">'; oPopup.document.body.onmouseover=new Function("clearTimeout(startani)") oPopup.document.body.onmouseout=pop oPopup.document.body.onclick=dowhat pop(); if (hideafter>0) setTimeout("dismisspopup()",hideafter*1000) } </SCRIPT>
|