Pages

Ads 468x60px

For New Update Use this Link http://dotnethubs.blogspot.in/ Offer for you

.

Showing posts with label java script time interval. Show all posts
Showing posts with label java script time interval. Show all posts

Saturday 6 July 2013

How will you open a new page after certain interval of time

Open new page in java script after some time interval

Introduction :-
Open the new page after some time interval using asp.net

More Details :-
 In my previous article i have provide the java script remove duplicate values from array  and java script get user IP address.

In this article i have show how i can redirect to asp.net or any html page after some interval without click of any user.This type of  functionality e use in html5 game for show the instruction and after display the instruction page automatically redirect to game play screen.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="interval.aspx.cs" Inherits="interval" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Java scripts Interval and redirect to other page</title>


     <script type="text/javascript">
         var i = 0;
         function ShowCurrentTime() {
             var dt = new Date();
             document.getElementById("lblTime").innerHTML = 5 - i + " Seconds";
             i++;
             if (i == 5) {
                 setTimeout("location.href='http://dotnetnukes.blogspot.in'", 0);
             }
             window.setTimeout("ShowCurrentTime()", 1000); // 1000 equal to 1 sec
         }
</script>
</head>
<body onload="ShowCurrentTime()">
    <form id="form1" runat="server">
  
    <div>
    <label id="lblTime" style=" font-weight:bold; font-size:x-large"></label>
    </div>
    </form>
</body>
</html>


Download sample code attached







 

..




New Updates

Related Posts Plugin for WordPress, Blogger...

Related Result