function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rv90rv90 

Count down Timer in VF page.

Hi guys, 

I am trying to develope a functionality where  a Visual force page should contains a Count down timer of 60 seconds and display a message as .....

Please wait... Processing (Display Timer count down starts from 60 sec).
Saurabh BSaurabh B
Hi Ravitej,
You should be able to do this using Javascript... See this fiddle,

http://jsfiddle.net/HRrYG/
 
function countdown() {
    var seconds = 60;
    function tick() {
        var counter = document.getElementById("counter");
        seconds--;
        counter.innerHTML = "0:" + (seconds < 10 ? "0" : "") + String(seconds);
        if( seconds > 0 ) {
            setTimeout(tick, 1000);
        } else {
            alert("Game over");
        }
    }
    tick();
}

countdown();

Please mark this as Best Answer if it helps you!