jQuery countdown and redirect.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<script type="text/javascript"> $(document).ready(function(){ var number = 10; var url = 'index.php?module=campaigns&action=sleep'; function redirect(number,url){ number = number; url = url; countdown(); } function countdown(){ setTimeout(countdown,1000); $('#redirect').html("Redirecting in "+number+" seconds."); number --; if(number<0){ window.location = url; number = 0; } } redirect(10,'index.php?module=campaigns&action=sleep'); }); </script> <div id="redirect"></div> |
ดูข้อมูลเพิ่มเติม https://www.youtube.com/watch?v=iO6ovnDo4FQ
ป้ายกำกับ:jQuery