1<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
2
3<h1 align="center" style="color:green">A countdown timer in jquery</h1>
4
5<h3 style="color:#FF0000" align="center">
6 You will be logged out in : <span id='timer'></span>
7 </h3>
8
9<script>
10 //define your time in second
11 var c=60;
12 var t;
13 timedCount();
14
15 function timedCount()
16 {
17
18 var hours = parseInt( c / 3600 ) % 24;
19 var minutes = parseInt( c / 60 ) % 60;
20 var seconds = c % 60;
21
22 var result = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
23
24
25 $('#timer').html(result);
26 if(c == 0 )
27 {
28 //setConfirmUnload(false);
29 //$("#quiz_form").submit();
30 window.location="logout.html";
31 }
32 c = c - 1;
33 t = setTimeout(function()
34 {
35 timedCount()
36 },
37 1000);
38 }
39 </script>
40