Introduction:
Here I will explain how to redirect to another page after 5 seconds or some time delay in jQuery.
Description:
In previous articles I explained JavaScript redirect to another page after 5 seconds, JQuery display Current Time on WebPage, Disable right click on image and many articles relating to JQuery and JavaScript. Now I will explain how to redirect to another page after 5 seconds or some time delay in jQuery.
In previous articles I explained JavaScript redirect to another page after 5 seconds, JQuery display Current Time on WebPage, Disable right click on image and many articles relating to JQuery and JavaScript. Now I will explain how to redirect to another page after 5 seconds or some time delay in jQuery.
To implement this functionality we need to write the following
code
<html xmlns="http://www.w3.org/1999/xhtml">
<head 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://www.aspdotnet-suresh.com'",
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>
|
Demo
Click Button to Redirect: |
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
8 comments :
hi sir i have a problem with visual studio 2008.at first i installed visual studio 2010 then i uninstalled it and again install vs 2008 now when i want to create new sql database the error genetared like
"this server virsion is not supported only server upto microsoft sql server 2005 is supported"
i also uninstall sql server 2008 from my computer but this error still come now what i have to ? please sir tell me its urgent
Hi, Sir This is anji varikuti...one of your articles followers.Your articles were very fine and Useful for all programmers...can u please send me Jquery basic concepts....?
Not all the time it is working... it works fine in IE. But try to run in firefox or chrome browser.
Try your code once again..
sir i want to learn ajax completely.. can u plz help me
@Manoj..
pls check your code I checked in all the browsers it's working perfectly.
@raj...
Pls check the articles whatever I written for Ajax I explained all the articles.
By: Vijaykumar Malthane
Very nice script; working perfectly in my web pages.
Note: Only a member of this blog may post a comment.