欢迎来到代码驿站!

JavaScript代码

当前位置:首页 > 网页前端 > JavaScript代码

设置下载不需要倒计时cookie(倒计时代码)

时间:2021-01-25 10:27:01|栏目:JavaScript代码|点击:
<!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">下载地址列表载入中&nbsp;<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>

上一篇:基于layui内置模块(element常用元素的操作)

栏    目:JavaScript代码

下一篇:JavaScript之面向对象_动力节点Java学院整理

本文标题:设置下载不需要倒计时cookie(倒计时代码)

本文地址:http://www.codeinn.net/misctech/50736.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有