Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Intermediate
Feb 20, 2002

Use JavaScript to Add a Timed Automatic Refreshing Function to a Page


Using the JavaScript program, you can let the user view a Web page only for certain time. After that specific period, without the user interaction the page will dispel another a page.
 
<lhtml>
<script language="JavaScript">
counter = 0;
id=setTimeout("goToNextPage();",1000);
function goToNextPage()
{
	counter++;
	if(counter >= 10)
	{
		alert ("Your Time is Over");
		document.fname.submit();
	}
	else
	{
		window.status="Remaining Seconds  " + counter;
	}
id=setTimeout("goToNextPage();",1000);
}
</script>
<body>
<form name="fname" method="post" action = "next.htm">
</form>
<font color="green">><h1>This page can viewed only _
for 10 Seconds. Hurry
Up</h1></font>
</body>
</html>

This code for next.htm page

<html>
<body>
<font color="red"><h1>Ur time is Over!!!!!!!!!</h1></font>
</body>
<html>
Kumaravel
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap