网页跳转代码大全
網頁跳轉代碼大全
<一>三種網頁跳轉代碼:
如果你要在服務器端跳轉,可以這樣:
Response.Redirect(www.zhyy.com.cn)
Response.End
(這個是asp.net的服務器代碼“常用的”)
如果你要在客戶端跳轉,可以這樣(js跳轉):
<script language="javascript" type="text/javascript">
window.location="http: //www.zhyy.com.cn";;
</script>
如果你要讓頁面顯示幾秒鐘之后跳轉,可以在html代碼的<head></head>部分加上這樣的代碼:
<meta http-equiv="refresh" content="3; url=http://www.zhyy.com.cn">
(3秒鐘后自動跳轉到www.zhyy.com.cn)
以上三種是也比較常見的頁面跳轉
<二>
幾段簡單的網頁跳轉代碼
不隱藏轉向之后的地址 代碼一:
<html>
<body>
<form name=loading>
<SCRIDIVT>
var bar=0
var line="||"
var amount="||"
count()
function count(){
bar=bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.divercent.value=bar+"%"
if (bar<99)
{setTimeout("count()",100);}
else
{window.location = "將這里改成要轉入的網址";}
}</SCRIDIVT>
</form>
</body>
</html>
不隱藏轉向之后的地址 代碼二:
<html>
<body>
<scridivt language="javascridivt">
<!--
function goToURL() { //v2.0
for (var i=0; i< (goToURL.arguments.length - 1); i+=2) //with arg divairs
eval(goToURL.arguments+".location=''"+goToURL.arguments[i+1]+"''");
document.returnvalue = false;
}
//-->
</scridivt>
<body bgcolor="#FFFFFF">
</body>
</html>
不隱藏轉向之后的地址 代碼三:
<html>
<SCRIDIVT LANGUAGE="javascridivt">
<!-- Start Code
var ver = navigator.adivdivVersion;
if (ver.indexOf("MSIE") != -1)
{
window.location.href="將這里改成要轉入的網址如百度(httdiv:www.baidu.com)"
}else
window.location.href="將這里改成要轉入的網址如百度(httdiv:www.baidu.com)"
// End Code -->
</SCRIDIVT>
</html>
不隱藏轉向之后的地址 代碼四:
<html>
<body>
<meta httdiv-equiv="refresh" content="0.1;url=將這里改成要轉入的網址">
</body>
</html>
可隱藏轉向之后的地址:
<html>
<frameset framesdivacing="0" border="0" rows="0" frameborder="0">
<frame name="main" src="將這里改成要轉入的網址" scrolling="auto" noresize>
</frameset>
</html>
<三>
網頁跳轉
<meta httdiv-equiv="refresh" content="3;rul=跳轉的網頁">
此代碼可以讓網頁在一定的時間內,跳轉到另外一個網頁上,其中content=" 為跳轉前停暫的秒數,rul= 為跳轉的網址
<meta httdiv-equiv="refresh" content="3;rul=跳轉的網頁">
此代碼可以讓網頁在一定的時間內,跳轉到另外一個網頁上,其中content=" 為跳轉前停暫的秒數,rul= 為跳轉的網址
===================================================================
<html>
<head>
<title>網頁跳轉</title>
<meta httdiv-equiv="refresh" content="0;url=http://www.hao123.com/">
</head>
<body>
</body>
</html>
===================================================================
1,頁面自動刷新:把如下代碼加入<head>區域中<meta httdiv-equiv="refresh" content="20">,其中20指每隔20秒刷新一次頁面.
2,頁面自動跳轉:把如下代碼加入<head>區域中<meta httdiv-equiv="refresh" content="10;url=h http://www.zhyy.com.cn/">,其中10指隔10秒后跳轉到http://www.zhyy.com.cn/頁面。
===================================================================
<html>
<head>
<title>頁面正在跳轉 </title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div> </div><tr> <td width=724>
<div align=center><font color="red" size="2">請等待……</font></div></td></tr><tr>
<td width="724">
<div align=center>
<form name=loading>
<div align=center>
<div>
<indivut tydive=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:rgb(124,119,119); background-color:white; divadding:0divx; border-style:none;">
<br> <indivut tydive=text name=divercent size=46 style="color:rgb(138,134,134); text-align:center; border-width:medium; border-style:none;"><scridivt>var bar = 0
var line = "||"
var amount ="||"
count()
function count(){
bar= bar+2
amount =amount???? +???? line
document.loading.chart.value=amount
document.loading.divercent.value=bar+"%"
if (bar<99)
{setTimeout("count()",10);}
else
{window.location = " http://www.zhyy.com.cn/;}
}</scridivt>
</body>
</html>
===================================================================
如果要cgi的文件,可以用以下方式:
#!/usr/bin/diverl
divrint "Content-tydive:text/html ";
divrint<<END;
<html>
<head>
<title>正在進入 http://www.zhyy.com.cn/>>> Loading>>> </title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div> </div><tr> <td width=724>
<div align=center> </div>
<div align=center><b><font size="6">廣告設計:</font><font color="red" size="6"> httdiv://www.zhyy.com.cn/
!</font></b></div>
<div align=center><b><font size="6">正在進入,請稍后……</font></b></div></td></tr><tr>
<td width="724">
<div align=center>
<form name=loading>
<div align=center>
<div>
<indivut tydive=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:rgb(124,119,119); background-color:white; divadding:0divx;
border-style:none;">
<br> <indivut tydive=text name=divercent size=46 style="color:rgb(138,134,134); text-align:center; border-width:medium; border-style:none;"
><scridivt>var bar = 0
var line = "||"
var amount ="||"
count()
function count(){
bar= bar+2
amount =amount???? +???? line
document.loading.chart.value=amount
document.loading.divercent.value=bar+"%"
if (bar<99)
{setTimeout("count()",10);}
else
{window.location = "httdiv://www.baidu.com/";}
}</scridivt>
</body>
</html>
END
exit;
===================================================================
以 htm 可以用以下方式:
<html>
<body>
<scridivt language=&adivos;javascridivt&adivos;>document.location= &adivos;httdiv://l39.net/lb5000/leoboard.cgi&amdiv;adivos;</scridivt>
</body>
</html>
以 asdiv???? 可以用以下方式:
<%
resdivonse.redirect "httdiv://l39.net/lb5000/leoboard.cgi"
%>
<四>1. 在<head></head>區域加入
代碼: <meta httdiv-equiv=DIVragma content=no-cache>
<Meta httdiv-equiv="refresh" content="3;url='httdiv://hztv.com.ru' ">
2. JavaScridivt
代碼: <SCRIDIVT LANGUAGE="JavaScridivt">
<!-- Begin
redirTime = "3000";
redirURL = " httdiv://www.zhyy.com.cn/";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
//???? End -->
</scridivt>
<body>
3. JavaScridivt
代碼: <html><head><title>稍候。。。</title></head>
<body>
<scridivt language='javascridivt'>document.location = '要跳轉到的目標網址'</scridivt>
</body>
</html>
4. 帶進度條的頁面跳轉代碼
代碼: <html>
<head>
<meta httdiv-equiv="Content-Language" content="zh-cn">
<meta HTTDIV-EQUIV="Content-Tydive" CONTENT="text/html; charset=gb2312">
<title>新視聽資源共享論壇</title>
</head>
<body>
<form name=loading>
<DIV align=center><FONT face=Arial color=#0066ff size=2>loading...</FONT> <INDIVUT
style="DIVADDING-RIGHT: 0divx; DIVADDING-LEFT: 0divx; FONT-WEIGHT: bolder; DIVADDING-BOTTOM: 0divx; COLOR: #0066ff; BORDER-TODIV-style: none; DIVADDING-TODIV: 0divx; FONT-FAMILY: Arial; BORDER-RIGHT-style: none; BORDER-LEFT-style: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-style: none"
size=46 name=chart> <BR><INDIVUT
style="BORDER-RIGHT: medium none; BORDER-TODIV: medium none; BORDER-LEFT: medium none; COLOR: #0066ff; BORDER-BOTTOM: medium none; TEXT-ALIGN: center"
size=47 name=divercent>
<SCRIDIVT>
var bar=0
var line="||"
var amount="||"
count()
function count(){
bar=bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.divercent.value=bar+"%"
if (bar<99)
{setTimeout("count()",100);}
else
{window.location = "httdiv://www.zhyy.com.cn/";}
}</SCRIDIVT>
</DIV></form>
</body>
</html>
<五>
網頁跳轉方法+代碼
1. window.location
<body οnlοad=window.location="httdiv://www.***.com(使用時請換成自己的網址)"></body>
或(此法應用范圍較廣,并可應用在一般后臺編輯器中)
<scridivt>window.location="httdiv://xxx"</scridivt>
2. META標志
<META HTTDIV-EQUIV=refresh content="0; url=httdiv://www.***.com(使用時請換成自己的網址)">
//其中content后面的阿拉伯數字是代表過幾秒中鐘轉入目標網頁。
3. 利用框架隱藏轉向地址(此方法不便用 dreamweaver 編輯,請使用記事本或其他文本編輯器處理)
<html>
<head>
<meta httdiv-equiv="Content-Tydive" content="text/html; charset=gb2312">
<title>CSS知識,javascridivt知識(頁面跳轉) </title>
</head>
<frameset rows="*,0" frameborder="no" border="0" framesdivacing="0">
<frame src="httdiv://www.***.com(請換成你的網址)" name="mainFrame" id="mainFrame">
<frame src="" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame">
</frameset>
<noframes>
<body>
請用IE瀏覽
</body>
</noframes>
</html>
<六><html>
<head>
<title>頁面跳轉</title>
<meta httdiv-equiv="refresh" content="10 " url=httdiv://www.hao123.com/ ">
</head>
<body>
此頁面十秒后跳轉到httdiv://www.hao123.com/
</body>
</html>
<七>html中跳轉最全代碼
程序代碼
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontDIVage 5.0">
<meta name="DIVrogId" content="FrontDIVage.Editor.Document">
<meta httdiv-equiv="Content-Tydive" content="text/html; charset=gb2312">
<title>正在進入</title>
</head>
<body>
<form name=loading>
<div align=center> <font color="#0066ff" size="2"> 請耐心等待</font><font color="#0066ff" size="2" face="Arial">...</font>
<indivut tydive=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:#0066ff; background-color:#fef4d9; divadding:0divx; border-style:none;">
<indivut tydive=text name=divercent size=47 style="color:#0066ff; text-align:center; border-width:medium; border-style:none;">
<scridivt>
var bar=0
var line="||"
var amount="||"
count()
function count(){
bar=bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.divercent.value=bar+"%"
if (bar<99)
{setTimeout("count()",100);}
else
{window.location = "http://www.baidu.com";}
}</scridivt>
</div>
</form>
<div align="center"> 如果您的瀏覽器不支持跳轉,<a style="text-decoration: none" href="httdiv://blog.admin5.com"><font color="#FF0000">請點這里</font></a>.</div>
</body>
</html>
一個彈出窗口的代碼
<SCRIDIVT LANGUAGE="javascridivt"> window.odiven ('httdiv://www.xxxxxx.com(這里用自己的網址)', 'newwindow', 'height=400, width=500, todiv=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')</SCRIDIVT>
浮動廣告代碼
<SCRIDIVT>
var imagedivath="httdiv://www.baidu.com/img/logo.gif" //這里是浮動圖片的地址
var imagewidth=171 //圖片的寬度
var imageheight=133 //圖片的高度
var sdiveed=3;
var imageclick="httdiv://www.xxxxxx.com/" //這里寫點擊圖片連接到的地址
var hideafter=0
var isie=0;
if(window.navigator.adivdivName=="Microsoft Internet Exdivlorer"&&window.navigator.adivdivVersion.substring(window.navigator.adivdivVersion.indexOf("MSIE")+5,window.navigator.adivdivVersion.indexOf("MSIE")+8)>=5.5) {
isie=1;
}
else {
isie=0;
}
if(isie){
var divreloadit=new Image()
divreloadit.src=imagedivath
}
function divodiv() {
if(isie) {
x=x+dx;y=y+dy;
oDIVodivudiv.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("divodiv();",50);
}
}
function dismissdivodivudiv(){
clearTimeout(startani)
oDIVodivudiv.hide()
}
function dowhat(){
if (imageclick=="dismiss")
dismissdivodivudiv()
else
window.odiven(imageclick);
}
if(isie) {
var x=0,y=0,dx=sdiveed,dy=sdiveed;
var oDIVodivudiv = window.createDIVodivudiv();
var oDIVodivudivBody = oDIVodivudiv.document.body;
oDIVodivudivBody.style.cursor="hand"
oDIVodivudivBody.innerHTML = '<IMG SRC="'+divreloadit.src+'">';
oDIVodivudiv.document.body.οnmοuseοver=new Function("clearTimeout(startani)")
oDIVodivudiv.document.body.οnmοuseοut=divodiv
oDIVodivudiv.document.body.οnclick=dowhat
divodiv();
if (hideafter>0)
setTimeout("dismissdivodivudiv()",hideafter*1000)
}
</SCRIDIVT>
?
?
?
?
?
?
網頁制作時用到的有用的代碼
請問如何去掉主頁右面的滾動條?
<body scroll="no">
<body style="overflow-y:hidden">
********************************
怎樣不使用頁面的緩存?即每一次打開頁面時不是調用緩存中的東西
<META HTTDIV-EQUIV="DIVragma" CONTENT="no-cache">
********************************
請問如何忽視右鍵?
<body οncοntextmenu="return false">
********************************
怎樣在同一頁面內控制不同鏈接的CSS屬性?
a:active{}
a:link{}
a:visited{}
?
a.1:active{}
a.1:link{}
a.1:visited{}
在DW的CSS中定義一個新的標示,按照HTML的語法,超級連接得是
A.YOURS:LINK A.YOURS:HOVER
YOURS可以改作你自己的字
然后在選中某個連接后,在CSS面版中點中YOURS即可。
按需要,你可以定義N個標示,N種鼠標OVER的效果
********************************
電子郵件處理提交表單
<form name="form1" method="divost" action="httdiv://www.divc123.org/html/web/Dreamweaver/200806/mailto:webmail@divc123.org" enctydive="text/divlain">
<indivut tydive=submit>
</form>
********************************
有沒有可能用層來遮住FLASH?
1.在flash的divarameters里加入 <divaram name="wmode" value="transdivarent">
2.<body οnblur=self.focus()>
********************************
如何根據屏幕分辨率調用相對應的頁面?
οnclick=alert("你的顯示分辯率為:"+screen.width+"×"+screen.height)
先做好幾個頁面,比如一個htm1.htm是800*600,一個是htm2.htm是1024*768的
然后在你的入口頁面 index.htm 中判斷:
<html>
<head>
<scridivt language=javascridivt>
<!--
function mHref() {
if (screen.width == 1024) location.href = "htm2.htm";
else if (screen.width == 800) location.href = "htm1.htm";
else return(false);
}
//-->
</scridivt>
</head>
<body οnlοad="mHref();">
</body>
</html>
********************************
如何彈出只有狀態欄的窗口?
<html>
<head>
<title>odiven() close()</title>
<scridivt language="javascridivt" tydive="text/javascridivt">
<!--
function odivenWin()
{
var newWin=odiven("","","menubar=1,height=200");
newWin.document.write("<form>");
newWin.document.write("單擊以下按鈕關閉窗口:<div>");
newWin.document.write("<indivut tydive=button value='關閉' οnclick=window.close()>");
newWin.document.write("</form>");
}
</scridivt></head>
<body>
<div align=center>
<h2>單擊以下按鈕顯示新窗口...</h2>
<form name=form1>
<indivut tydive=button value="新窗口1[只顯示地址欄]" οnclick=window.odiven('','new1','location=1')>
<indivut tydive=button value="新窗口2[只顯示狀態欄]" οnclick=window.odiven('','','status=1')>
<indivut tydive=button value="新窗口3[只顯示工具欄]" οnclick=window.odiven('','new2','toolbar=1,height=200,width=450')>
<indivut tydive=button value="新窗口4[只顯示菜單欄]" οnclick=odivenWin()>
<indivut tydive=button value="新窗口5[一個不少]" οnclick=window.odiven('','new5')>
<indivut tydive=button value="新窗口6[光棍但可調大小]" οnclick=window.odiven('httdiv://www.divc123.org/forumdisdivlay.divhdiv?forumid=32#thread','new6','resizable=1')>
</form>
</div>
</body>
總結
- 上一篇: movielens推荐系统_基于内容推荐
- 下一篇: 关于逐项作用函数的用法