javascript页面跳转常用代码

2009-11-16 19:20

按钮式:

<INPUT name="pclog" type="button" value="/GO" onClick="location.href='http://www.itpx.net/'">

链接式:

<a href="javascript:history.go(-1)">返回上一步</a>

<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>

直接跳转式:

<script>window.location.href='http://www.itpx.net';</script>

开新窗口:

<a href="/javascript:" onClick="window.open('http: //www.itpx.net','','height=500,width=611,scrollbars=yes,status =yes')">培训</a>

页面跳转代码集锦

1 <meta http-equiv="refresh" content="秒; url=下一个页面">

2

<script language="JavaScript">
<!--
var userAgent = navigator.userAgent;
var MSIEIndex = userAgent.indexOf("MSIE");
if (userAgent.indexOf("Win") != -1 &&
userAgent.indexOf("MSIE") != -1 &&
userAgent.substring((MSIEIndex + 5),(MSIEIndex + 8)) >= 5.5)
window.location.replace("http://www.shuigong.com");
//-->
</script>

没时间转移

3

有些人想访问网站时,直接进入某个子目录中的文件,如cgi-bin/leoboard.cgi,这时,你只要写一个默认的首页文件如index.htm,内容如下,就可以实现你的要求.
方法一:

<html>
<head>
<title>网页跳转</title>
<meta http-equiv="refresh" content="0;url=cgi-bin/leoboard.cgi">
</head>
<body>
</body>
</html>



方法二
<html>
<head>
<title>正在进入>>> Loading>>> </title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p> </p><tr> <td width=724>
<p align=center><font color="red" size="2">正在进入,请等待,谢谢......</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>


跳转代码
1:
<script language="j avascript">
location.replace("http://www.***.com")
</script>


2:
<script language="j avascript">setTimeout(window.location="http://www.dinmo.net",0)
</script>

3:
<script language="JavaScript" >
bName = navigator.appName;
if ((bName == "Netscape") ||
(bName == "Microsoft Internet Explorer")) window.location=http://www.dinmo.net;
</script>

<FRAMESET rows='*'>
<FRAMESET cols='*'>
<FRAME SRC='http://www.dinmo.net'>
<noframes>


JS实现跳转代码_多域名指向同一空间

<script>try { if( self.location == "http://玉米一/" ) {
top.location.href = "http://玉米一/目录";
}
else if( self.location == "http://玉米二/" ) {
top.location.href = "http://玉米二/目录";
}
else if( self.location == "http://玉米三/" ) {
top.location.href = "http://玉米三/目录";
}
else if( self.location == "http://玉米四/" ) {
top.location.href = "http://玉米四/目录";
}
else { document.write ("错误的访问地址") } } catch(e) { }</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Loading</title>
</head>

<body>

<form name="loading">

<p align="center">正在跳转,请稍后...</p>

<p align="center">
<input type="text" name="bar" style="border-style:none; background-color:#D3E8D0; font-weight:bold" />
<input type="text" name="percentage"style="border-style:none; background-color:#FFFFFF; max-width:30px"/>
</p>

<p align="center">
如果您的浏览器不支持跳转,请点击<a href="http://www.qdpin.cn/bbs">这里</a>手动跳转
</p>

<script language="javascript" type="text/javascript"> 
var percent=0;  //百分比进度,显示在滚动条后面
var element="||"; //滚动条单元竖线
var elements="||";  //滚动条当前竖线
count(); //开始调用循环

function count(){ 
percent=percent+10; //每次百分比加10
elements =elements + element; //滚动条当前竖线增加一个滚动条单元竖线
document.loading.bar.value=elements;  //设置窗体loading表单中bar元素的当前值
document.loading.percentage.value=percent+"%";  //设置窗体loading表单中percentage元素的当前值
if (percent<99){ //percent小于99则继续循环
setTimeout("count()",500); //每500ms进行一次count()
} 
else{
window.location = "http://www.baidu.com"; //percent达到100时跳转
} 
}
</script>

</form>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值