js倒计时天时分秒[转]
<script language="JavaScript">
<!-- // function getQueryString(name) {
var reg =new RegExp("(^|&)"+ name +"=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r !=null) return unescape(r[2]); return null;
} var currentDate = new Date();
var strEndTime = getQueryString("EndTime");//http://www.abc.com/page.html?EndTime=2012/10/23 10:20:30
var EndTime=new Date(strEndTime); var days= EndTime - currentDate;
EndTimeMsg = parseInt(days / 1000);//精确到秒 function show() {
h = Math.floor(EndTimeMsg / 60 / 60);
m = Math.floor((EndTimeMsg - h * 60 * 60) / 60);
s = Math.floor((EndTimeMsg - h * 60 * 60 - m * 60));
document.getElementById("DD").innerHTML = parseInt(h/24);
document.getElementById("HH").innerHTML = h;
document.getElementById("MM").innerHTML = m;
document.getElementById("SS").innerHTML = s;
EndTimeMsg--;
if (EndTimeMsg < 0)
{
document.getElementById("DD").innerHTML = "0";
document.getElementById("HH").innerHTML = "00";
document.getElementById("MM").innerHTML = "00";
document.getElementById("SS").innerHTML = "00";;
}
}
setInterval("show()", 1000) // -->
</script>
<div>
<strong id="DD"></strong>天 <strong id="HH"></strong>时 <strong id="MM"></strong>分 <strong id="SS"></strong>秒
</div>
http://www.cnblogs.com/ricky_li/archive/2012/10/23/2735793.html
js倒计时天时分秒[转]的更多相关文章
- JS倒计时——天时分秒
HTML代码: <div id="times_wrap" class="time_num"> 距离结束时间: <div cl ...
- JQ倒计时天时分秒
<div id="times_wrap" class="time_num"> 距离现在时间: <div class="time_w& ...
- JS时间处理,获取天时分秒
//获取时间的天,小时,分钟,秒 function ToTime(second) { second = second / ; var result ; ) % ; ) % ; * )); ) { re ...
- JS时间处理,获取天时分秒。以及浏览器出现的不兼容问题
//获取时间的天,小时,分钟,秒 function ToTime(second) { second = second / ; var result ; ) % ; ) % ; * )); ) { re ...
- JS倒计时两种种实现方式
最近做浏览器界面倒计时,用js就实现,两种方式: 一:设置时长,进行倒计时.比如考试时间等等 代码如下: <html> <head> <meta charset=&quo ...
- js倒计时demo 天/时/分/秒
<html><head> <meta charset="UTF-8"> <title>js简单时分秒倒计时</title> ...
- JS倒计时两种种实现方式 很不错
最近做浏览器界面倒计时,用js就实现,两种方式: 一:设置时长,进行倒计时.比如考试时间等等 代码如下: <html> <head> <meta charset=&quo ...
- js倒计时-倒计输入的时间
计算指定时间到指定时间之间相差多少天.时.分.秒. 节日.活动.商城常用. 原理: 主要使用到时间戳,也就是从1970 年 1 月 1 日 到指定时间的毫秒数. 1. 求出毫秒差 :当两个时间直接进行 ...
- js 倒计时(可自定义时间)
<html> <head> <title>js 倒计时</title> </head> <body> <div> & ...
随机推荐
- 什么是RAW数据?
现在数码照片的存储格式,以及在网络上应用的最普遍的图片格式就是JPEG格式了(Joint Photographic Expert Group).但是作为一种有损的图像压缩格式(现在也有少数数码相机提供 ...
- 2016年10月27日 星期四 --出埃及记 Exodus 19:12
2016年10月27日 星期四 --出埃及记 Exodus 19:12 Put limits for the people around the mountain and tell them, `Be ...
- Http 请求
public static string HttpGet(string url) { HttpWebRequest request = (HttpWebRequest)WebRequest.Creat ...
- Intent官方教程(4)用Intent构造应用选择框
Forcing an app chooser When there is more than one app that responds to your implicit intent, the us ...
- 【SQL】SQL中笛卡尔积、内连接、外连接的数据演示
SQL的查询语句中,常使用到内连接.外连接,以及连接的基础--笛卡尔积运算. 在简单的SQL中,也许我们还分辨清楚数据如何连接,一旦查询复杂了,脑子也犯浆糊了,迷迷糊糊的. 本文,简单以数据形式记录连 ...
- mysql 用sql语句查询一个表中的所有字段类型、注释
SELECT column_name,column_comment,data_type FROM information_schema.columns WHERE table_name='表名' AN ...
- Python3基础 count 返回指定元素在列表中的个数
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...
- linux内核中的GPIO系统之(1):软件框架
一.前言 作为一个工作多年的系统工程师,免不了做两件事情:培训新员工和给新员工分配任务.对于那些刚刚从学校出来的学生,一般在开始的时候总是分配一些非常简单的任务,例如GPIO driver.LED d ...
- [转]Unity3D协程介绍 以及 使用
作者ChevyRay ,2013年9月28日,snaker7译 原文地址:http://unitypatterns.com/introduction-to-coroutines/ 在Unity中,协 ...
- ALV详解:OO SALV
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...