PC:
1.html页面:
<div class="aTime"> <em id="t_d"></em> <em id="t_h"></em> <em id="t_m"></em> <em id="t_s"></em> </div>
2.js:
<script type="text/javascript"> function GetRTime(){ var end = "<?php echo $info['end_date']; ?>"+" 23:59:59"; var EndTime= new Date(end); var NowTime = new Date(); var t =EndTime.getTime() - NowTime.getTime(); var d=0; var h=0; var m=0; var s=0; if(t>=0){ d=Math.floor(t/1000/60/60/24); h=Math.floor(t/1000/60/60%24); m=Math.floor(t/1000/60%60); s=Math.floor(t/1000%60); } document.getElementById("t_d").innerHTML = d; document.getElementById("t_h").innerHTML = h; document.getElementById("t_m").innerHTML = m; document.getElementById("t_s").innerHTML = s; } setInterval(GetRTime,1000); </script>
以上代码在safari中出错,原因是: