Samizdatová skripta

Časovač


Alarm objektově

var alarm = {
  remind: function(aMessage) {
    //alert(this.timeoutID);
    hop();
    delete this.timeoutID;
  },

  setup: function() {
    this.cancel();
//alert("start");
    var self = this;
    this.timeoutID = window.setTimeout(function(msg) {self.remind(msg);}, 3000, "Wake up!");
  },

  cancel: function() {
    if(typeof this.timeoutID == "number") {
    //alert("stpd");
 window.clearTimeout(this.timeoutID);
 delete this.timeoutID;
 //alert(":"+this.timeoutID)
    }
  }
};

upravit odstranit css

NAVRCHOLU.cz