<p align=center><font size=6 face="黑体"><b>2013年情人节</b></font></p>
<script language=JavaScript>
<!--
var now = new Date(); function currenttime()
{
var dtime = new Date("2/14/2013");
now.setTime(now.getTime()+100);
days = (dtime - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (dtime - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (dtime - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
if(minutesRound<=9)
minutesRound="0"+minutesRound
seconds = (dtime - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.floor(seconds);
if(secondsRound<=9)
secondsRound="0"+secondsRound
time.innerHTML = daysRound + "天" +hoursRound + "小时" + minutesRound + "分" + secondsRound + "秒";
}
setInterval("currenttime()",100);
//-->
</script>
<p align=center>距离2013年2月14日还有<span id="time"></span></p>
<script language=JavaScript>
<!--
var now = new Date(); function currenttime()
{
var dtime = new Date("2/14/2013");
now.setTime(now.getTime()+100);
days = (dtime - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (dtime - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (dtime - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
if(minutesRound<=9)
minutesRound="0"+minutesRound
seconds = (dtime - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.floor(seconds);
if(secondsRound<=9)
secondsRound="0"+secondsRound
time.innerHTML = daysRound + "天" +hoursRound + "小时" + minutesRound + "分" + secondsRound + "秒";
}
setInterval("currenttime()",100);
//-->
</script>
<p align=center>距离2013年2月14日还有<span id="time"></span></p>
解决方案 »
- 这种情况如何ajax post,百度GOO半天无果
- 关于settimeout()
- 怎么可以加个符号
- 关于javascript 规则表达式的问题,着急
- javascript表单提交问题
- Unable to get image data from canvas because the canvas has been tainted by cros
- 如何用代码打开加了密码的Acess数据库??
- 请问禁止使用复制功能的JS代码如何写?注意不是禁止右键~!谢谢!
- 警告框问题
- JavaScript隐藏秘技 (2)
- !function($){}(window.jQuery)是什么意思
- Jquery问题: 无法获取插入的html元素对象
(function(w){
if(w.BindDate)return;
w.BindDate=function(dom)
{
if(dom.Timer)return;
dom.Timer= setInterval(function(){SetDate(dom)},100);
}
var SetDate=function(dom){var dtime = new Date("2/14/2013");
now.setTime(now.getTime()+100);
days = (dtime - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (dtime - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (dtime - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
if(minutesRound<=9)
minutesRound="0"+minutesRound
seconds = (dtime - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.floor(seconds);
if(secondsRound<=9)
secondsRound="0"+secondsRound
dom.innerHTML = daysRound + "天" +hoursRound + "小时" + minutesRound + "分" + secondsRound + "秒";
}
})(window)
<p align=center>距离2013年2月14日还有<span id="time"></span></p>
<script src="name.js"></script>name.js
var now = new Date();
function currenttime()
{
var dtime = new Date("2/14/2013");
now.setTime(now.getTime()+100);
days = (dtime - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (dtime - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (dtime - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
if(minutesRound<=9)
minutesRound="0"+minutesRound
seconds = (dtime - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.floor(seconds);
if(secondsRound<=9)
secondsRound="0"+secondsRound
time.innerHTML = daysRound + "天" +hoursRound + "小时" + minutesRound + "分" + secondsRound + "秒";
}
setInterval("currenttime()",100);