Make a JavaScript Countdown Timer in OOP

JavaScript Countdown Timer is the type of JavaScript code presented on JavaScriptBank.com; and you can find many good scripts as you want; but this JavaScript countdown timer is new one, because it's built in OOP completely. And this JavaScript countdown timer maybe the simplest example JavaScript code to start learning JavaScript OOP.


Sampled by © JavaScriptBank.com

Documentation

On the markup side create an element with id=container

init function accepts 3 parameters : minutes, seconds and the id of html element where the countdown will be displayed. You will also need a function which will run after the timer’s execution has completed. For this purpose there is the function timerComplete included in the timer.js file. Write any code here that you would like to execute after timer has terminated (like redirect the user).

Also make sure that you have an html element with id set to container on your html page. Above timer will do a countdown for 55 seconds. After 55 seconds, function timerComplete will be executed.

2000+ free JavaScripts
at www.JavaScriptBank.com