页面连续刷新js控制

<script>
    function button(param,lasttime){
 this.param=param;
 this.lasttime=lasttime;
 
 
 }

 
  button.prototype.setLasttime=function(lasttime){
      
      this.lasttime=lasttime;
  };
   button.prototype.getLasttime=function(){
       return this.time;
  };
   button.prototype.dec=function(nowtime){
      var time=false;
     if(this.lasttime==null){
     this.setLasttime(nowtime);
  time=true;
  return time;
  }else{
          
        if(nowtime-this.lasttime>2000){
     this.setLasttime(nowtime);
   time=true;
   return time;
  }
  }
  return time;
   };
  button.prototype.show=function(){
      var nowtime=new Date().getTime();
      var t=this.dec(nowtime);
    
   alert(t);
     if(t){
     alert("谢谢!");
  }else{
    alert("请等待!");
  }
    
  }
    var dd="";
 var bt=new button(dd,false);
   

 
 </script>
   </head> <body>  <div>
  <input type="button"  value="提交" onclick="bt.show();"/></div>
 </body>
</html>

你可能感兴趣的:(html,prototype)