Jump to content

Implementing Download Coundown Code


phillipw1994

Recommended Posts

I was given this code for a Download Countdown timer, similar to Rapidshares and Megaupload

 

//implements
  Implements: [Options,Events],

  //options
  options: {
    element: 'countdown',
    start: 10,
    finish: 0,
    startFont: '36px',
    finishFont: '12px',
    onComplete: $empty,
    duration: 1000
  },
  
  //initialization
  initialize: function(options) {
    //set options
    this.setOptions(options);
  },
  
  //get things started
  start: function() {
    this.anim();
  },
  
  //animate!
  anim: function() {
    this.options.element.set('text',this.options.start--);
    var fx = new Fx.Tween(this.options.element,{
      duration: this.options.duration,
      link: 'ignore',
      onComplete: function() {
        if(this.options.start >= this.options.finish) {
          this.anim();
        } else {
          this.fireEvent('complete');
        }
      }.bind(this)
    }).start('font-size',this.options.startFont,this.options.finishFont);
  }
});

/* usage */
window.addEvent('domready',function() {
  var cd = new CountDown({
    element: $('countdown'),
    start: 12,
    finish: 0,
    onComplete: function() {
      this.options.element.set('text','Done! Your special code is: <!--?php echo rand(1000,5000); ?-->').setStyle('color','#090');
    }
  }).start();
});

 

but i haven't the faintest idea on what to do with it. Does it go into PHP, Html or Javascript. I know a lot about HTML a little PHP.  but i don't have a clue when it comes to Javascript codes and adding them to pages.

 

Please Help

Link to comment
https://forums.phpfreaks.com/topic/245271-implementing-download-coundown-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.