比如说 我要在21:30分在客户端自动刷新一下网页?求完整代码 我是PHP菜鸟!

解决方案 »

  1.   

    function(hours,second){
        (function(){
        var d = new Date();
        var h = d.getHours();
        var s = d.getMinutes();
        console.log(h,s);
        
        if(h == hours  && s == second){ 
            alert(['时间到了',d]);
        }
        setTimeout(arguments.callee,60*1e3);
        })();
    })(21,9);
      

  2.   

    var dates = new Date();
    var hours = dates.getDate();
    var minutes = dates.getMinutes();
    var timers = setInterval(function() {
      if(hours == 21) {
        if(minutes == 30) {
          clearInterval(timers);
          window.location.reload();
          setInterval(function() {
            window.location.reload();
          }, 24*60*60*1000);
        }
      }
    }, 0);
      

  3.   

    var dates = new Date();
    var hours = dates.getDate();
    var minutes = dates.getMinutes();
    var timers = setInterval(function() {
      if(hours == 21) {
        if(minutes == 30) {
          clearInterval(timers);
          window.location.reload();
          setInterval(function() {
            window.location.reload();
          }, 24*60*60*1000);
        }
      }
    }, 1000);盗用楼上的