<script>

var mins = 0.10;

var secs = mins * 60;
function countdown() {
    setTimeout('Decrement()',1000);
}
function Decrement() {
    if (document.getElementById) {
        minutes = document.getElementById("minutes");
        seconds = document.getElementById("seconds");
        // if less than a minute remaining

        if (seconds < 59) {
            seconds.value = secs;

        } else {
            minutes.value = getminutes();
            seconds.value = getseconds();
        }
        secs--;
        setTimeout('Decrement()',1000);

        if (secs == 0) 
        {
         alert('time up !!! You must submit your Answer ');       
         }

    }
}   
function getminutes() {
    // minutes is seconds divided by 60, rounded down
    mins = Math.floor(secs / 60);
    return mins;

}
function getseconds() {
    // take mins remaining (as seconds) away from total seconds remaining
    return secs-Math.round(mins *60);
}

</script>

You could add a counter that counts how many times the function has been executed. If it reaches 10, you could prevent the timeout from being set again. I hope that's clear enough :).

dude pls tell briefly ....

Your script should include something like this:

var number_of_timeouts_executed = 0;

// (Your decrement function:)
function decrement() {

    // If 10 or more timeouts have already been excuted, it's been 10 seconds or more. 
    // Don't execute this function again.
    if(number_of_timeouts_executed >= 10)
        return false;

    number_of_timeouts_executed++;

    // (Your timeout:)
    setTimeout();
}

minitauros ....i understand .....Thank you dude :)-

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.