织梦倒计时
{dede:arclist row=8 titlelen=32 addfields='time' channelid='18′} <li><span> <input type="hidden" id="gettime" value="[field:time function='strftime("%b %d %Y %H:%M:%S",@me)'/]" /> <input type="hidden" id="gettitle" value="[field:title/]" /> <script> function Clock() { var Today=new Date(); //var PPQday=new Date(2012,9-1,28); //你想倒计时的结束日期 var PPQday=new Date(document.getElementById('gettime').value); //你想倒计时的结束日期 var DayTime = (PPQday.getTime()-Today.getTime())/ 1000 / 60 / 60 /24; var days = parseInt(DayTime);//天 var HourTime =(DayTime - days)*24; var hours =parseInt(HourTime);//时 var MinutesTime =(HourTime-hours)*60; var minutes = parseInt(MinutesTime);//分 var SecondTime =(MinutesTime-minutes)*60; var seconds = parseInt(SecondTime); //秒 document.getElementById("PPQTime").innerHTML= "距"+document.getElementById("gettitle").value+"倒计时 "+ days + "天"; //+ ForMat(hours)+"小时"+ForMat(minutes)+"分"+ForMat(seconds)+"秒"; setTimeout(Clock,1000); } function ForMat(data) { if(data<10) return "0"+data; else return data; } </script> <div id="PPQTime"></div> </span></li> {/dede:arclist}