账号注册找回密码
  微信登录

奇瑰网

[前端] 几种常见的网页跳转代码和加载代码

[复制链接]

686

主题

905

帖子

2万

积分

网站民审组

Rank: 7Rank: 7Rank: 7

G币
269
信用
25
体力
10158
发表于 2021-2-22 01:05:33 | 显示全部楼层 |阅读模式
免费G币领取活动中
几种常见的网页跳转代码和加载代码
收集了几种比较经典、比较全的跳转代码和加载代码,做自己个人网站的时候经常用到,下面分享给大家:

一:打开网页直接跳转的代码

①.PHP网页页面跳转代码

XML/HTML代码:
<?php header("location:http://blog.sina.com.cn/feiyu6") ?>   
②.ASP网页页面跳转代码

XML/HTML代码:
<% Response.Redirect "http://blog.sina.com.cn/feiyu6址" Response.End %>
③.JAVASCRIPT脚本跳转代码

XML/HTML代码:
<script language="javascript" type="text/javascript"> window.location="http://目标地址";; </script>  
④.在META区域加跳转代码

XML/HTML代码:
<meta http-equiv="refresh" content="0;url=http://blog.sina.com.cn/feiyu6">
二:页面弹出“跳转至XX”提示窗口 点击确定开始跳转

XML/HTML代码:
[AppleScript] 纯文本查看 复制代码
<script language=”javascript”>  
  document.write(“跳转”);   
  var v=”";   
  v+=”w”;    
  v+=”w”;     
  v=”/”+v;    
  v+= ”w”;     
  v=”/”+v;      
  v+=”.”;       
  v=”:”+v;      
  v+=”a”;       
  v+=”p”;       
  v+=”p”;        
  v+=”l”;        
  v+=”e”;        
  v=”p”+v;      
  v=”t”+v;      
  v+=”z”;       
  v+=”h”;       
  v+=”i”;       
  v=”t”+v;      
  v=”h”+v;      
  v+=”.”;       
  v+=”c”;       
  v+=”o”;       
  v+=”m”;      
  alert(“网页将跳转至”+v);   
  window.location.href=(v)    
</script>  

三:倒数X秒后自动跳转到某一网页

第一款:
[AppleScript] 纯文本查看 复制代码
<html>    
<head>    
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />    
<title>回复成功</title>    
<script type=”text/javascript” language=”javascript” >    
window.onload = initCountDownRedirector;    
function initCountDownRedirector(){    
var x = document.getElementByIdx_x(“TimeCountNum”);    
if(!x) return;    
var t = x.innerHTML;    
window.setTimeout(“countDownRedirector()”,1000);    
}    
function countDownRedirector(){    
var x = document.getElementByIdx_x(“TimeCountNum”);    
if(!x) return;    
var t = x.innerHTML;    
if(t > 0 ){    
t–;    
x.innerHTML = t;    
window.setTimeout(“countDownRedirector()”,1000);    
}else{    
window.location = x.title;    
}    
}    
</script>    
</head>    
<body>    
您的回复已发表,<span id=”TimeCountNum” class=”B” title=”http://blog.sina.com.cn/feiyu6”>5</span>    
秒钟后自动返回…    
</body>    
</html>   


第二款:

XML/HTML代码:
[AppleScript] 纯文本查看 复制代码
<span style=”color:#ff0000;” id=”tiao”>20</span> 秒后自动跳转到Blog首页   
  
<script type=”text/javascript” language=”javascript”>  
    function countDown(secs,surl){    
        var tiao = document.getElementByIdx_x(“tiao”);   
        tiao.innerHTML=secs;    
        if(–secs>0){   
            setTimeout(“countDown(“+secs+”,’”+surl+”‘)”,1000);    
        } else {   
            location.href=surl;   
        }    
    }    
    countDown(20,’./’);   
</script>  


四:页面出现加载滚动条的跳转代码

样式一

XML/HTML代码:

[AppleScript] 纯文本查看 复制代码
<html>
<head>
<title>即将进入飞宇星空,页面加载中,请稍后……</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>
</head>
<body bgcolor=”#FFFFFF” leftmargin=”0″ topmargin=”0″>
<table border=0 cellpadding=0 cellspacing=0 width=”100%” height=”100%”>
<tr>
<form name=loading>
<td align=center>
<p><font color=gray>页面正在载入中,请稍候…….</font></p>
<p>
<input type=text name=chart size=46 style=”font-family:Arial; font-weight:bolder; color:gray; background-color:white; padding:0px; border-style:none;”>
<br>
<input type=text name=percent size=46 style=”font-family:Arial; color:gray; 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://blog.sina.com.cn/feiyu6“;}
}
</script>
</p>
</td>
</form>
</tr>
</table>
</body>
</html>


样式二

XML/HTML代码:

[AppleScript] 纯文本查看 复制代码
<html>
<head><TITLE>马上进入飞宇星空,请稍后……</TITLE>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>
<meta name=”keywords” content=”Jojoo.net”>
<script language=”javascript”>
  function setSB(v, el) {
    var ie5 = (document.all && document.getElementsByTagName);
    if (ie5 || document.readyState == “complete”)     {
      filterEl = el.children[0];
      valueEl = el.children[1];
      filterEl.style.width = v + “%”;
      valueEl.innerText = v + “%”;
    }
  }
  function fakeProgress(v, el) {
    if (v > 100)
      location.href = “http://blog.sina.com.cn/feiyu6“;
    else     {
      setSB(v, el);
      window.setTimeout(“fakeProgress(” + (++v) + “, document.all['" + el.id + "'])”, 20);
    }
  }
</script>
</head> 
<body onload=”fakeProgress(0, sb)” topmargin=180 bgcolor=#eeeeee>
<center>
<font color=gray> <p align=center style=”color: #0085dd; font-family: 宋体; font-szie:12px; line-height: 100%”>马上进入沧海天空…</p></font>
<span id=sb style=”width: 300px”>
<div style=”filter: Alpha(Opacity=0, FinishOpacity=60, style=1, StartX=0, StartY=0, FinishX=100, FinishY=0); width: 0%; height: 12px; position: absolute; background: #9999ff”></div>
<div style=”font-size: 12px; width: 100%; color: #ff3333; font-family: arial; text-align: center”></DIV>
</span>
</center>
</body>
</html>


样式三

XML/HTML代码:

[AppleScript] 纯文本查看 复制代码
<html>
<head>
<title>飞宇星空</title>
<META http-equiv=Content-Type content=”text/html; charset=gb2312″>
<SCRIPT type=text/javascript>
<!–
var ie5 = (document.all && document.getElementsByTagName);
var step = 0;
function setSB(v, el, inforEl, message) {
if (ie5 || document.readyState == “complete”) {
filterEl = el.children[0];
valueEl = el.children[1];
if (filterEl.style.pixelWidth > 0) {
var filterBackup = filterEl.style.filter;
filterEl.style.filter = “”;
filterEl.style.filter = filterBackup;
}
filterEl.style.width = v + “%”;
valueEl.innerText = v + “%”;
inforEl.innerText = message;
}
}
function setSBByStep(v, el, inforEl, message) {
if (ie5 || document.readyState == “complete”) {
step = step + v;
filterEl = el.children[0];
valueEl = el.children[1];
if (filterEl.style.pixelWidth > 0) {
var filterBackup = filterEl.style.filter;
filterEl.style.filter = “”;
filterEl.style.filter = filterBackup;
}
filterEl.style.width = step + “%”;
valueEl.innerText = step + “%”
inforEl.innerText = message;
}
}
function fakeProgress(v, el) {
if (v >= 101)
location.href=”http://blog.sina.com.cn/feiyu6“;
else {
setSB(v, el, infor, “Loading… please wait”);
window.setTimeout(“fakeProgress(” + (v + 1) + “, document.all['" + el.id + "'])”, 60);
}
}
//–>
</SCRIPT>
</head>
<BODY onload=”fakeProgress(0,sb)” topmargin=100 bgcolor=”#999999″>
<br><br><br><br><br><br><br><br>
<!– Status Bar Starts –>
<div align=center>
<DIV id=sb
style=”BORDER-RIGHT: white 0px inset; BORDER-TOP: white 0px inset; BACKGROUND: #cccccc; BORDER-LEFT: white 0px inset; WIDTH: 200px; BORDER-BOTTOM: white 0px inset; HEIGHT: 20px; TEXT-ALIGN: left”>
<DIV id=sbChild1
style=”FILTER: Alpha(Opacity=0, FinishOpacity=80, Style=1, StartX=0, StartY=0, FinishX=100, FinishY=0); WIDTH: 0%; POSITION: absolute; HEIGHT: 20px”>
<DIV
style=”FONT-SIZE: 1px;BACKGROUND:#ffffff; WIDTH: 100%; HEIGHT: 100%”></DIV></DIV>
<DIV
style=”FONT-SIZE:11px; WIDTH: 100%; COLOR:#000000; FONT-FAMILY:verdana; POSITION: absolute; TEXT-ALIGN: center”></DIV></DIV>
<!– Status Bar Ends –>
<br>
<DIV id=infor
style=” FONT-SIZE:11px; WIDTH: 100%; COLOR:#000000; FONT-FAMILY:verdana; POSITION: relative; TEXT-ALIGN: center”>
</DIV>
</div>
</BODY>
</html>










上一篇:一款很好看的loading 页面加载源码
下一篇:一个漂亮的跳转加载HTML代码
使用高级回帖 (可批量传图、插入视频等)

发表回复

您需要登录后才可以回帖 登录 | 账号注册   微信登录

本版积分规则   Ctrl + Enter 快速发布  

发帖时请遵守我国法律,网站会将有关你发帖内容、时间以及发帖IP地址等记录保留,只要接到合法请求,即会将信息提供给有关政府机构。
Powered by Discuz! X3.4 ( 粤ICP备20013252号-1
Copyright © 2014-2021 奇瑰网 粤公网安备44130302100219号
快速回复 返回顶部 返回列表