1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
function counter(time,url){ var interval = setInterval(function(){ $('#counter').text(time); time = time -1; if(time == 0){ clearInterval(interval ); window.location = url; } }, 1000); } $(document).ready(function(){ counter(10, 'http://google.com.hk'); });
Sign in to leave a comment.