倒计时效果在IE下正常显示在火狐下为什么不显示
<scriptlanguage=JavaScript><!--functioncurrenttime(){varnow=newDate();vardtime=newDat...
<script language=JavaScript>
<!--
function currenttime()
{
var now = new Date();
var dtime = new Date("8/8/2011");
now.setTime(now.getTime()+100); //getTime()返回当前时间距离1970/01/01的毫秒数,setTime()返回 向 1970/01/01 添加毫秒,并显示新的日期和时间。
days = (dtime - now) / 1000 / 60 / 60 / 24;//这里可以改成(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
time1.innerHTML = daysRound;
time2.innerHTML = hoursRound;
time3.innerHTML = minutesRound;
time4.innerHTML = secondsRound;
//time.innerHTML = daysRound + "天" +hoursRound + "小时" + minutesRound + "分" + secondsRound + "秒";
}
setInterval("currenttime()",100); ////??
//-->
</script>
这个倒计时在火狐下为什么不显示 展开
<!--
function currenttime()
{
var now = new Date();
var dtime = new Date("8/8/2011");
now.setTime(now.getTime()+100); //getTime()返回当前时间距离1970/01/01的毫秒数,setTime()返回 向 1970/01/01 添加毫秒,并显示新的日期和时间。
days = (dtime - now) / 1000 / 60 / 60 / 24;//这里可以改成(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
time1.innerHTML = daysRound;
time2.innerHTML = hoursRound;
time3.innerHTML = minutesRound;
time4.innerHTML = secondsRound;
//time.innerHTML = daysRound + "天" +hoursRound + "小时" + minutesRound + "分" + secondsRound + "秒";
}
setInterval("currenttime()",100); ////??
//-->
</script>
这个倒计时在火狐下为什么不显示 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询