网页跳转代码汇总

分类:wiki浏览量:1434发布于:9年前

站长朋友网站建设中,常常会用到页面跳转,在这里念鲜为大家提供了几段常用代码,一起来看看吧:

------------------------------------------------------------------------------

不隐藏转向之后的地址 代码一

------------------------------------------------------------------------------

<html>

<head>

<meta http-equiv="Content-Language" content="zh-cn">

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">

<title></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> <BR><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 = "将这里改成要转入的网址";}

}</SCRIPT>

</P></form>

</body>

</html>

-------------------------------------------------------------------------------

不隐藏转向之后的地址 代码二

-------------------------------------------------------------------------------

<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','将这里改成要转入的网址');return document.returnvalue">

</body>

</html>

------------------------------------------------------------------------------

不隐藏转向之后的地址 代码三

-------------------------------------------------------------------------------

<html>

<head>

<meta http-equiv="Content-Language" content="zh-CN">

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">

<title></title>

</head>

<SCRIPT LANGUAGE="javascript">

<!-- Start Code

var ver = navigator.AppVersion;

if (ver.indexOf("MSIE") != -1)

{

window.location.href="将这里改成要转入的网址"

}else

window.location.href="将这里改成要转入的网址"

// End Code -->

</SCRIPT>

</html>

-------------------------------------------------------------------------------

不隐藏转向之后的地址 代码四

-------------------------------------------------------------------------------

<html>

<head>

<meta http-equiv="Content-Language" content="zh-CN">

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">

<title></title>

</head>

<body>

<meta http-equiv="refresh" content="0.1;url=将这里改成要转入的网址">

</body>

</html>

-------------------------------------------------------------------------------

可隐藏转向之后的地址

-------------------------------------------------------------------------------

<html>

<head>

<meta http-equiv="Content-Language" content="zh-CN">

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">

<title></title>

</head>

<frameset framespacing="0" border="0" rows="0" frameborder="0">

<frame name="main" src="将这里改成要转入的网址" scrolling="auto" noresize>

</frameset>

</html>

-------------------------------------------------------------------------------

可设置转向时间

-------------------------------------------------------------------------------

<html>

<head>

<meta http-equiv="refresh" content="2;url=http://www.fabu114.com/">

</head>

<body>


</body>

</html>

其中url是网址,content是时间按秒计算!

-------------------------------------------------------------------------------

可设置转向时间,以10秒位例

-------------------------------------------------------------------------------

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>自动跳转</title>

<style type="text/CSS">

<!--

.border {

border:0px;

margin: 0px;

}

-->

</style>

</head>

<body onload="setTimeout('show_secs()',1)">

<SCRIPT LANGUAGE="JAVASCRIPT">

<!--

timer=10;

var timerID;

function show_secs () // show the time user spent on the side

{

if(timer>0)

{

timer=timer-1

document.fm0.time_spent.value = timer;

timerID=setTimeout('show_secs()',1000);

}

else

{

location.href ="将这里改成要转入的网址"

clearTimeout(timerID)

}

}

-->

</SCRIPT>

<form name="fm0">

再过 <INPUT name="time_spent" type="text" class="border" size=2 readonly="true">秒将自动跳转!

</form>

</body>


如果以上代码无法实现,也可以选择以下三种:

<html>

<head>

<meta http-equiv="Content-Language" content="zh-CN">

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">

<meta http-equiv="refresh" content="0.1;url=http://www.wendabaike.com">

<title></title>

</head>

<body>

</body>

</html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>正在进入</title>

</head>

<body>

<form name=loading>

<p align=center> <font color="#0066ff" size="2">正在进入,请稍等</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://www.wendabaike.com";}

}</script>

</p>

</form>

<p align="center"> 如果您的浏览器不支持跳转,<a style="text-decoration: none" href="http://www.wendabaike.com"><font color="#FF0000">请点这里</font></a>.</p>

</body>

</html>

<html>

<head><title>稍候。。。</title></head>

<body>

<script language='javascript'>document.location = 'http://www.wendabaike.com'</script>

</body>

</html>


标签:代码

 上一篇 下一篇 

我来回答

猜你喜欢

最近更新