blogspot visit counter

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

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 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" "">

<html xmlns="">
<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";
             if (i == 5) {
                 setTimeout("location.href=''", 0);
             window.setTimeout("ShowCurrentTime()", 1000); // 1000 equal to 1 sec
<body onload="ShowCurrentTime()">
    <form id="form1" runat="server">
    <label id="lblTime" style=" font-weight:bold; font-size:x-large"></label>

Download sample code attached

1 comment:

Related Posts Plugin for WordPress, Blogger...