设置下载不需要倒计时cookie(倒计时代码)
所属分类:
网络编程 / JavaScript
阅读数:
1252
收藏 0赞 0分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<title>下载地址页面</title>
<script type="text/javascript">
//20080824设置下载不需要倒计时cookie
document.cookie="downvip=888";
String.prototype.trim = function ()
{
return this.replace(/^\s+|\s+$/, '');
}
var IE_all_cache = new Object();
function IE_getElementById(id)
{
if (IE_all_cache[id] == null)
{
IE_all_cache[id] = document.all[id];
}
return IE_all_cache[id];
}
if (document.all)
{
if (!document.getElementById)
{
document.getElementById = IE_getElementById;
}
}
function waitForDownload()
{
if (waitingTime <= 0)
{
document.getElementById("wait_to_download").style.display = 'none';
document.getElementById("download_link").style.display = 'inline';
clearInterval(downloadTimer);
}
else
{
document.getElementById("remaining_secs").innerHTML = waitingTime;
}
waitingTime --;
}
if (window.parent != window)
{
window.parent.location = window.location;
}
</script>
</head>
<body>
<div class="description">
</div>
<div class="down_box">
<span id="wait_to_download">下载地址列表载入中 <span id="remaining_secs">10</span></span>
<span id="download_link" style="display: none; ">
<a href="https://www.jb51.net">脚本之家</a>
</span>
</div>
<script type="text/javascript">
var waitingTime = 10;
var downloadTimer = setInterval("waitForDownload()", 1000);
//Hash 判断是否需要倒计时
if (window.location.hash == "#thunder")
waitingTime = 0;
//cookie判断是否需要倒计时
//获取cookie字符串
var strCookie=document.cookie;
//将多cookie切割为多个名/值对
var arrCookie=strCookie.split("; ");
var downvip;
//遍历cookie数组,处理每个cookie
for(var i=0;i<arrCookie.length;i++){
var arr=arrCookie[i].split("=");
//找到名称为downvip的cookie,并返回它的值
if("downvip"==arr[0]){
downvip=arr[1];
break;
}
}
if(downvip == 888){
waitingTime = 0;
}
</script>
</body>
</html>
JSONP原理及简单实现
这篇文章主要介绍了JSONP原理及简单实现的相关资料,非常不错具有参考借鉴价值,需要的朋友可以参考下
收藏 0赞 0分享
浅析JSONP技术原理及实现
这篇文章主要介绍了浅析JSONP技术原理及实现 的相关资料,非常不错具有参考借鉴价值,需要的朋友可以参考下
收藏 0赞 0分享
json的使用小结
下面小编就为大家带来一篇json的使用小结。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0赞 0分享
js验证框架之RealyEasy验证详解
这篇文章主要为大家详细介绍了js验证框架之RealyEasy验证,记录了RealyEasy验证的使用步骤,感兴趣的小伙伴们可以参考一下
收藏 0赞 0分享
webpack中引用jquery的简单实现
下面小编就为大家带来一篇webpack中引用jquery的简单实现。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0赞 0分享
查看更多