Forums

This topic is locked

redirect based on date

Posted 27 Apr 2004 18:25:23
1
has voted
27 Apr 2004 18:25:23 Stefan P posted:
Anyone on this forum have the answer to this. My javascript is real basic and I'm not sure I want to get stuck into another Wrox at the moment!

www.dmxzone.com/forum/topic.asp?TOPIC_ID=27882&FORUM_ID=10&CAT_ID=5&Topic_Title=Date+redirection&Forum_Title=JavaScript

Cheers

DMX | ASP | VBScript | ACCESS | IIS5

Edited by - sesame on 27 Apr 2004 18:26:22

Replies

Replied 12 May 2004 15:43:20
12 May 2004 15:43:20 Stefan P replied:
I amended a script and came up with:

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ronnie T. Moore -->
<!-- Web Site: The JavaScript Source -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! javascript.internet.com -->

function launchCheck() {
var today = new Date(); // today
var date = new Date("June 1, 2004"; // your launch date

if (today.getTime() > date.getTime()) { // on or after launch date
window.location.href='www.microsoft.com';
}
else { // before launch date
window.location.href='www.google.com';
}
}

launchCheck();

</script>

Works just fine!

DMX | ASP | VBScript | ACCESS | IIS5

Edited by - sesame on 12 May 2004 15:45:47

Reply to this topic