Guest User

Reloj "bomba" 24h - Puntoinfinito

a guest
Jun 20th, 2012
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!------ Puntoinfinito ------>
  2. <div id="clock1">05<span class="small">Hrs </span>34<span class="small">Min </span>20<span class="small">Sec </span>
  3.  
  4.  
  5.       <script language="JavaScript">
  6. /* Update clock for 24hr to start at 06/19/2012 1600 EET - 1400 GMT */
  7.   StartCountDown("clock1","06/19/2012 01:00 PM -2400")  
  8.   /*
  9.     Author:     Puntoinfinito (www.infiniter.tk)
  10.   */
  11.  
  12.   function StartCountDown(myDiv,myTargetDate)
  13.   {
  14.     var dthen   = new Date(myTargetDate);
  15.     var dnow    = new Date();
  16.     ddiff       = new Date(dthen-dnow);
  17.     gsecs       = Math.floor(ddiff.valueOf()/1000);
  18.     CountBack(myDiv,gsecs);
  19.   }
  20.  
  21.   function Calcage(secs, num1, num2)
  22.   {
  23.     s = ((Math.floor(secs/num1))%num2).toString();
  24.     if (s.length < 2)
  25.     {  
  26.       s = "0" + s;
  27.     }
  28.     return (s);
  29.   }
  30.  
  31.   function CountBack(myDiv, secs)
  32.   {
  33.     var DisplayStr;
  34.     var DisplayFormat = "%%H%%" + "<span class='small'>Hrs </span>" + "%%M%%"  + "<span class='small'>Min </span>" + "%%S%%" + "<span class='small'>Sec </span>";
  35.     DisplayStr = DisplayFormat.replace(/%%D%%/g,    Calcage(secs,86400,100000));
  36.     DisplayStr = DisplayStr.replace(/%%H%%/g,       Calcage(secs,3600,100));
  37.     DisplayStr = DisplayStr.replace(/%%M%%/g,       Calcage(secs,60,60));
  38.     DisplayStr = DisplayStr.replace(/%%S%%/g,       Calcage(secs,1,60));
  39.     if(secs > 0)
  40.     {  
  41.       document.getElementById(myDiv).innerHTML = DisplayStr;
  42.       setTimeout("CountBack('" + myDiv + "'," + (secs-1) + ");", 990);
  43.     }
  44.     else
  45.     {
  46.       document.getElementById(myDiv).innerHTML = "BUUUM!";
  47.     }
  48.   }
  49.  
  50. </script>
RAW Paste Data