专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Javascript教程 » phpcookie倒计时:设置下载不需要倒计时cookie(倒计时代码) »正文

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

来源: 发布时间:星期四, 2008年12月25日 浏览:158次 评论: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; char=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<title>下载地址页面</title>
<script type="text/javascript">
//20080824设置下载不需要倒计时cookie
document.cookie="downvip=888";
String.prototype.trim = function
{
this.replace(/^\s+|\s+$/, '');
}
var IE_all_cache = Object;
function IE_getElementById(id)
{
(IE_all_cache[id] null)
{
IE_all_cache[id] = document.all[id];
}
IE_all_cache[id];
}
(document.all)
{
(!document.getElementById)
{
document.getElementById = IE_getElementById;
}
}
function waitForDownload
{
(waitingTime <= 0)
{
document.getElementById("wait_to_download").style.display = 'none';
document.getElementById("download_link").style.display = 'inline';
clearInterval(downloadTimer);
}

{
document.getElementById("reing_secs").innerHTML = waitingTime;
}
waitingTime --;
}
(window.parent != window)
{
window.parent.location = window.location;
}
</script>
</head>
<body>
<div ="description">
</div>
<div ="down_box">
<span id="wait_to_download">下载地址列表载入中 <span id="reing_secs">10</span></span>
<span id="download_link" style="display: none; ">
<a href="http://www.jb51.net">脚本的家</a>
</span>
</div>
<script type="text/javascript">
var waitingTime = 10;
var downloadTimer = Interval("waitForDownload", 1000);
//Hash 判断是否需要倒计时
(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("=");
//找到名称为downvipcookie并返回它
("downvip"arr[0]){
downvip=arr[1];
;
}
}
(downvip 888){
waitingTime = 0;
}
</script>
</body>
</html>
0

相关文章

读者评论

发表评论

  • 昵称:
  • 内容: