网页跳转大全

<一>三种网页跳转代码:

如果你要在服务器端跳转,可以这样:

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 onload=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.onmouseover=new Function("clearTimeout(startani)")

oDIVodivudiv.document.body.onmouseout=divodiv

oDIVodivudiv.document.body.onclick=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 oncontextmenu="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 onblur=self.focus()>

********************************

如何根据屏幕分辨率调用相对应的页面?

onclick=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 onload="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='关闭' onclick=window.close()>");

newWin.document.write("</form>");

}

</scridivt></head>

<body>

<div align=center>

<h2>单击以下按钮显示新窗口...</h2>

<form name=form1>

<indivut tydive=button value="新窗口1[只显示地址栏]" onclick=window.odiven('','new1','location=1')>

<indivut tydive=button value="新窗口2[只显示状态栏]" onclick=window.odiven('','','status=1')>

<indivut tydive=button value="新窗口3[只显示工具栏]" onclick=window.odiven('','new2','toolbar=1,height=200,width=450')>

<indivut tydive=button value="新窗口4[只显示菜单栏]" onclick=odivenWin()>

<indivut tydive=button value="新窗口5[一个不少]" onclick=window.odiven('','new5')>

<indivut tydive=button value="新窗口6[光棍但可调大小]" onclick=window.odiven('httdiv://www.divc123.org/forumdisdivlay.divhdiv?forumid=32#thread','new6','resizable=1')>

</form>

</div>

</body>

 

posted @ 2013-11-25 18:14  小丑004  阅读(1141)  评论(0编辑  收藏  举报