设置下载不需要倒计时cookie(倒计时代码)
所属分类:
网络编程 / JavaScript
阅读数:
1204
收藏 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>
纯javascript判断查询日期是否为有效日期
很多网站都涉及到输入日期选项,如果客户日期输入错误,可能导入查询不到甚至查询到错误的信息,为了更好的满足用户需求,需要对日期进行校验,下面给大家介绍使用纯javascript如何判断查询日期是否为有效日期,需要的朋友可以参考下
收藏 0赞 0分享
jquery实现的蓝色二级导航条效果代码
这篇文章主要介绍了jquery实现的蓝色二级导航条效果代码,涉及jquery鼠标事件及页面样式的动态切换效果实现技巧,非常简单实用,需要的朋友可以参考下
收藏 0赞 0分享
ajax如何实现页面局部跳转与结果返回
AJAX即“Asynchronous Javascript And XML”(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术,通过在后台与服务器进行少量数据交换,AJAX 可以使网页实现异步更新,本篇文章给大家介绍ajax如何实现页面局部跳转与结果返
收藏 0赞 0分享
js实现的黑背景灰色二级导航菜单效果代码
这篇文章主要介绍了js实现的黑背景灰色二级导航菜单效果代码,涉及javascript操作页面元素动态切换的实现技巧,非常具有实用价值,需要的朋友可以参考下
收藏 0赞 0分享
javascript中SetInterval与setTimeout的定时器用法
Javascript的setTimeOut和setInterval函数应用非常广泛,它们都用来处理延时和定时任务,比如打开网页一段时间后弹出一个登录框,页面每隔一段时间发送异步请求获取最新数据等,本文文章通过代码示例给大家介绍javascript中SetInterval与setT
收藏 0赞 0分享
jQuery实现的背景动态变化导航菜单效果
这篇文章主要介绍了jQuery实现的背景动态变化导航菜单效果,涉及jquery页面元素背景动态变换的实现技巧,非常具有实用价值,需要的朋友可以参考下
收藏 0赞 0分享
查看更多