JavaScript怎么实现点击按钮出现三天倒计时三天后才能点击? 30
展开全部
<!DOCTYPE html><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> <script> var interval; var djs = function(){ if(!!interval) return; var d = new Date("1111/1/1,1:0:0"); result.innerHTML = d.getHours() + "时" + d.getMinutes() + "分" + d.getSeconds() + "秒"; interval = setInterval(function(){ if(d.getHours() ==0&&d.getMinutes()==0&&d.getSeconds()==0) { clearInterval(interval); interval =null; } result.innerHTML = d.getHours() + "时" + d.getMinutes() + "分" + d.getSeconds() + "秒"; d.setSeconds(d.getSeconds() - 1); },1000); } </script> </head><body> <div id="result"> </div> <button onclick="djs()"> 倒计时 </button> </body></html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询