自动刷新倒计时

<span class=”mdjs” data-time=”{$r[djs]}”></span>
<script>
function after(){

$(“.mdjs”).each(function(i){

var show_time=$(this).attr(“data-time”);
show_time=show_time-1;

var day = Math.floor(show_time/86400);
var hour = Math.floor(show_time%86400/3600);
var minute = Math.floor(show_time%86400%3600/60);
var second = Math.floor(show_time%86400%3600%60);
var unixTimestamp=day+’天’+hour+’时’+minute+’分’+second+’秒’;
$(this).html(unixTimestamp);

$(this).attr(“data-time”,show_time);
//console.log(show_time);
})

setTimeout(function(){
after();
},1000);
}

$(document).ready(function(e) {
after();
});
</script>