Monthly Archives: April 2010

Javascript – jQuery – Timer

0
Filed under javascript, jquery
Tagged as , , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: Click counter with jQuery framework.

<html>
  <head>
    <title>Twitter like text area</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
    <script type="text/javascript">
      $(function(){
          setTimeout(run_timer, 0);
	  var minutes = 0;
	  var seconds = 0;

	  function run_timer() {
	    setTimeout(run_timer, 1000);
	    if(minutes > 0) {
	      time = minutes + " minutes " + seconds + " seconds";
	    } else {
	      time = seconds + " seconds";
	    }

	    if(seconds == 59) {
	      seconds = 0;
      	      minutes++;
	    }
	    $("#timer").text(time);
	    seconds++;
	  }
        });
    </script>
  </head>
  <body>
  <div id="timer">  </div>
  </body>
</html>



javascrip,logo,badge,pixel badge