找回密码
 加入科信
查看: 1158|回复: 0

网页跳转常用代码

[复制链接]
admin 发表于 2011-7-23 00:37:53 | 显示全部楼层 |阅读模式
◆直接跳转方式
◇跳转到某页:
<script language="javascript" type="text/javascript">
window.opener.location='http://www.kxlzw.com';
</script>
或 <script>window.location.href='http://www.kxlzw.com/';</script>
或 <script>location="http://www.kxlzw.com/"</script>
◇返回本页:
<script>alert("返回"); window.history.back(-1); </script>
◇跳转到上一页:
<script>self.location='top.htm';</script>

◆<body>方式
◇ <body onload=window.location="http://www.kxlzw.com/"></body> //在<body> 里添加代码

◆meta 方式
◇20秒自动刷新:
<meta http-equiv="refresh" content="20"> //将代码加入<head>区域中。
◇3秒后自动跳转:
<meta http-equiv="refresh" content="3;url=http://www.kxlzw.com">

◆事件驱动方式
◇单击事件驱动跳转:
<Span>单击事件驱动跳转</Span>

◆按钮方式
◇点击按钮跳转:
<INPUT name="" type="button" value="跳转">
◇点击按钮3秒跳转:
<INPUT name="" type="button" value="跳转">
◇点击按钮3秒跳转:
<script>
function goto(url,dalay)
{
setTimeout("window.location='"+url+"'",dalay);
}
</script>
<button>跳转</button>

◆链接方式
◇链接跳转:
<a href='http://www.kxlzw.com/'>打开链接</a>
◇返回上一步:
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>返回上一步</a>

◆开新窗口
◇打开新窗口 :
<script language="javascript" type="text/javascript">
window.open('http://www.kxlzw.com');
</script>
或 <script>open('http://www.kxlzw.com')</script>
◇用事件驱动打开新窗口 :
<Span>打开新窗口</Span>
◇用链接打开新窗口 :
<a href='http://www.kxlzw.com' target=_blank >打开新窗口</a>
◇打开一个固定大小的新窗口:
<script>window.open('http://www.kxlzw.com','','height=500,width=600')</script>
◇用按钮打开一个固定大小的新窗口:
<INPUT name="" type="button" value="开新窗口">
<button>开新窗口</button>
◇用链接打开一个固定大小的新窗口:
<a href="javascript:"http://www.kxlzw.com','','height=500,width=600,scrollbars=yes,status=yes'">http://www.kxlzw.com','','height=500,width=600,scrollbars=yes,status=yes')">开新窗口</a>
◇打开一个新窗口一个原窗口
<a href='地址2'target=_blank >打开一个新窗口一个原窗口</a>
<a href='地址2'>打开一个新窗口一个原窗口</a>
<button>打开一个新窗口一个原窗口</button>
<button>打开一个新窗口一个原窗口</button>
◇打开两个新窗口
<a href='地址2'target=_blank >打开两个新窗口</a>
<button>打开两个新窗口</button>
<script>
function openwin() {
window.open ('地址1', 'newwindow1', 'width=宽,height=高') //写成一行
window.open ('地址2', 'newwindow2', 'width=宽,height=高') //写成一行
}
</script>
<button>打开两个新窗口</button>

◆带进度条跳转
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>跳转到itlearner.com</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 language="javascript">
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.kxlzw.com";
}
}
</script>
</P>
</form>
</body>
</html>

您需要登录后才可以回帖 登录 | 加入科信

本版积分规则

关闭

站长推荐上一条 /1 下一条

Archiver|手机版|小黑屋|科信联众网

GMT+8, 2024-5-3 20:56 , Processed in 0.140625 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表