Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2004, 04:17 AM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default From today's links to other htmlpages after define


Hello,
I am trying to master (?) JavaScript and I am a little bit in trouble now.
On the "index.html" are a lot of links, each one leading to another html.page.
How can I change (or redirect) to another html.page after a well defined period of time (ex. 5 or 12 days from now on).
So people go automatically to another htmlpage (to see different content) from that specific date.


I tried with the expression <body onLoad="fctionChange">.
Trying to write this "fctionChange" I don't know how to handle the date of today and the date in the future.
I guess it has something to do with " if .... else", but I'ts a hard time to make it work.
Maybe I am wrong and it has nothing to do with the "onLoad"event.

Can anyone of you please help me or give me some helpfull tips.
Thanks a lot.

I posted this thread already, but maybe I was not clear enough.
So this is a new try to set things straight.
Sorry .. and thanks for trying to help me.

jef



 
Old August 19th, 2004, 01:13 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

To redirect to another page after x many seconds:
Code:
var delay = 5; //set delay to the amount of seconds before redirecting

var newpage = "http://www.google.com/"; //set newpage to the page to redirect to

delay = delay * 1000;

setTimeout("window.location.replace(newpage)",delay);
Hope this helps

Snib

<><





Similar Threads
Thread Thread Starter Forum Replies Last Post
Display today's date in a Dropdownlist dcct84 C# 2 October 5th, 2007 09:20 AM
How to define .tld wesleygch JSP Basics 1 April 10th, 2007 07:54 AM
Can u define difference ? gvcc_neel .NET Framework 2.0 4 October 10th, 2005 04:56 AM
Please Define SDK eberly General .NET 2 April 10th, 2005 04:49 PM
Database define Controls everthalia ASP.NET 1.0 and 1.1 Basics 0 July 26th, 2004 08:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.