<html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <div id="countdown">还剩 30 分 00 秒</div> <script> window.onload=function(){ var countdown=document.getElementById("countdown"); var time=1800;//30分钟换算成1800秒 setInterval(function(){ time=time-1;
var minute=parseInt(time/60); var second=parseInt(time%60); countdown.innerHTML='还剩'+minute+'分'+second+'秒'; },1000); } </script> </body> </html>