Created
May 4, 2016 13:45
-
-
Save sivaprabug/db50d1f0da1d0dc8c9d7ea4b4d96f2d3 to your computer and use it in GitHub Desktop.
Javascript countdown redirect to another page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title></title> | |
| </head> | |
| <body> | |
| <form name="redirect"> | |
| <center> | |
| <font face="Arial"><b>You will be redirected to the script in<br><br> | |
| <form> | |
| <input type="text" size="3" name="redirect2"> | |
| </form> | |
| seconds</b></font> | |
| </center> | |
| <script> | |
| var targetURL = "http://10.0.136.11/sivaprabug/js.html" | |
| var countdownfrom = 10 | |
| var currentsecond = document.redirect.redirect2.value = countdownfrom + 1 | |
| function countredirect() { | |
| if (currentsecond != 1) { | |
| currentsecond -= 1 | |
| document.redirect.redirect2.value = currentsecond | |
| } else { | |
| window.location = targetURL | |
| return | |
| } | |
| setTimeout("countredirect()", 1000) | |
| } | |
| countredirect() | |
| //--> | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment