Pagina 1 din 1

Script Numaratoare inversa

Scris: Mie Dec 11, 2013
de cosatzy
Salut , imi puteti da si mie un script numaratoare inversa de 10 minute.
"Va rugam asteptati: 10 minute."
Multumesc.

Script Numaratoare inversa

Scris: Joi Dec 12, 2013
de MarPlo
Salut
Incearca sa te descurci cu acest cod:

Cod: SelectaĊ£i tot

Asteptati: &nbsp; <span id="showmns">00</span>:<span id="showscs">00</span>
<script type="text/javascript"><!--
function countdownTimer(mnt, scs) {
  // https://coursesweb.net/javascript/
  // gets data for minutes and seconds
  ctmnts = mnt;
  ctsecs = scs;

  // decrease seconds, and decrease minutes if seconds reach to 0
  ctsecs--;
  if(ctsecs < 0) {
    if(ctmnts > 0) {
      ctsecs = 59;
      ctmnts--;
    }
    else {
      ctsecs = 0;
      ctmnts = 0;
    }
  }

  // display the time in page, and auto-calls this function after 1 seccond
  if(document.getElementById('showmns') && document.getElementById('showscs')) {
    document.getElementById('showmns').innerHTML = ctmnts;
    document.getElementById('showscs').innerHTML = ctsecs;
  }
  if(ctsecs > 0 || ctmnts > 0) setTimeout('countdownTimer('+ ctmnts +', '+ ctsecs +')', 1000);
  else alert('Gata');
}

// strat the countdown (10 minutes, 0 seconds)
countdownTimer(10, 0);
//-->
</script>