PDA

View Full Version : Navigation to a page after a date has passed



DR.Wong
Nov 24th, 2005, 09:39 AM
Hey guys!

How do you make a code that will navigate to a page, after a specific date.
Eg: Before December 25 I want a page in my site to 'redirect' to lets say 'temp.htm', but after the 25 December has passed, it must go to 'homepage.htm'.

I want to try and use this for easy updating in Dec-Feb when I will have no Internet.

If any of you know how, please, share your wisdom!

Thanks Alot and happy holidays!!!:thumbsup: :)

PhotoJoe47
Nov 24th, 2005, 10:20 AM
I think that this tutorial will help you.

http://www.javascriptkit.com/javatutors/datedifference.shtml

Study this for a little while and see if you do want to do. If not come back with some of your sample code that you tried and I think someone should be able to help you fine tune it.

ubik
Nov 24th, 2005, 11:57 AM
sorry i posted in error, i was thinking about something else.. use the script KOR posted below.
:thumbsup:

Kor
Nov 24th, 2005, 12:27 PM
what about if the year changes?

better use Date() object for both dates


<script type="text/javascript">
var today = new Date()
var limitday = new Date(2005,11,25)
onload=function(){
location.href=(today>limitday)?'homepage.html':'temp.html';
}
</script>