<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<body>
<div class="bd">
<div class="time"><span class="dn">距离xx开始还有:</span><br/>
<span class="h" id="miaosha_hour">0</span><br/>
<span class="m" id="miaosha_min">0</span><br/>
<span class="s" id="miaosha_sec">0</span></div><br/>
</div>
</body>
<?php date_default_timezone_set("Asia/ShangHai");//地区?>
<script type="text/javascript">
var runtimes = 0;
$(document).ready(function (){
GetRTime();
});
//倒计时
function GetRTime(){
var nMS = <?php echo 9000;//time参数 ?>-runtimes*1000;
if(nMS > 0){
var nH=Math.floor(nMS/(1000*60*60));
var nM=Math.floor(nMS/(1000*60)) % 60;
var nS=Math.floor(nMS/1000) % 60;
$("#miaosha_hour").html(nH);
$("#miaosha_min").html(nM);
$("#miaosha_sec").html(nS);
runtimes++;
setTimeout("GetRTime()",1000);
}
}
</script>
</html>
js+php实现倒计时
最新推荐文章于 2021-04-04 16:40:51 发布