Menu ▼



Posted By :
avatarmrkraju
Total Views : 2850

Reload or Redirect the page to a specific url using javascript

By Using JavaScript setTimeout function we can redirect the page to a specific URL after a specific time. if we give the same URL the page will reload continuously in specific time interval.

Example:


Source Code:
<html>
<head>
    <script language="JavaScript">
    var count=5;
    window.onload = function () {
        setTimeout(reloadpage, 5000);
        showtime();
    }
        function reloadpage() {
            window.location.href = "http://www.dotnetlearners.com"
        }
        function showtime() {
            document.getElementById("spntime").innerHTML = count;
            count--;
            setTimeout(showtime, 1000);
        }
    </script>
</head>
<body>
    This page will redirect in <span id="spntime"></span> seconds....
</body>
</html>







comments powered by Disqus


Search dotnetlearners.com