Thursday, 17 January 2013

AutoRedirect Logic

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>JavaScript redirect to another page after 5 seconds or Sometime</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript">
    var i = 0;
    $(document).ready(function () {
        ShowCurrentTime();
    })
    function ShowCurrentTime() {
        var dt = new Date();
        document.getElementById("lblTime").innerHTML = 5 - i + " Seconds";
        i++;
        if (i == 5) {
            setTimeout("location.href='http://csharp1236.blogspot.in/'", 0);
        }
        window.setTimeout("ShowCurrentTime()", 1000);
    }
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
This Page will Redirec to Another Page within:
<label id="lblTime" style=" font-weight:bold; font-size:12pt"></label>
</div>
</form>
</body>
</html>

No comments:

Post a Comment