html
<h4><span class="minute"></span> : <span class="second"></span></h4>
script
$(function(){ /* 倒计时 */ var ms ='14:59'; var min = ms.split(":")[0], num =ms.split(":")[1], timer; if(min<10){ $(".minute").html("0"+min); }else{ $(".minute").html(min); } if(num<10){ $(".second").html("0"+num); }else{ $(".second").html(num); } timer = setInterval(function() { if (min == 0 && num == 0) { clearInterval(timer) return; } if (num > 0) { num = num - 1; curnum = num; if(num<10){ $(".second").html("0"+curnum); }else{ $(".second").html(curnum); } } else { if (num == 0) { num = 59; $(".second").html(num); } min = min - 1; curmin = min; if(min<10){ $(".minute").html("0"+curmin); }else{ $(".minute").html(curmin); } } }, 1000); /* 倒计时 */ })