krot

js TIMER

Feb 8th, 2016
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <span id="timer">10</span>
  2. <script>
  3. setInterval(function(){TIMER();},1000);
  4. var s=10;
  5. function TIMER(){
  6. if(!s)document.location.href = '/';
  7. document.getElementById('timer').innerHTML=s;
  8. s--;
  9. }
  10. ///
  11.  
  12. $('[data-file]').click(function(elobj){
  13. var timer=60;
  14.  
  15.  
  16. var intervalID=setInterval(function(){
  17. if(timer--){
  18. setFText(timer);
  19. }else{
  20.  
  21. clearInterval(intervalID);//останов
  22. }
  23. },100);
  24. });
  25. </script>
RAW Paste Data