PDA

View Full Version : HELP!! Redirect based on time and date?



jameswsparker
01-31-2011, 03:14 AM
Hello all.
I have created a 2 frame site where I want the top frame (header) to redirect the other frame (main) to a different page depending on the date, time, and second.
For example, on 12 FEB at 07:00:00, I would like the header frame to redirect the main frames page to EmmasBday.html; in which I would be alerted of my little sisters Birthday.

This is for personal use and isn't going to be hosted online so I will just use JavaScript, it's basically a simple system to remind me of crucial events at certain times and dates so I don't forget them.
The same events will apply every year, so there is no need to programme in specific years although having the option could prove useful.
I am aware of other alternatives to achieve this, but would very much like to work with JavaScript; as I can expand it.

As I state, this is for personal use and therefore won't be hosting it; I will use JavaScript throughout and cannot use anything else like PHP, Perl, etc.
I am aware JavaScript takes the time & date from the computer hosting it (unlike PHP), which is fine.

So, for example; at 14:30:00 I will be informed to get dinner; and at 15:00:45 I'll be informed to study.

The knowledge you guys have presented so far is phenomenal, and I couldn't think of anybody better to ask for assistance.
Anyway, I hope you can resolve my problem and I'm looking forward to a response! :)

Thanks for your concern, you brain Gods you! :D:thumbsup: AHa.

Philip M
01-31-2011, 09:24 AM
This is in effect the same question that you asked at
http://www.codingforums.com/showthread.php?t=216963


<script type="text/javascript">

var currentTime = new Date()
var dt = new Date(2011,1,12,7,0,0); // months in Javascript are 0-11
alert (dt); // for testing
if (currentTime > dt ) {
window.location = "EmmasBday.html;";
}

else {
alert ("Future Date Not Yet reached");
}

</script>

</html>

Helpdesk: Double click on "My Computer"
User: I can't see your computer.
Helpdesk: No, double click on "My Computer" on your computer.
User: Huh?
Helpdesk: Do you see an icon on the left of your computer screen labeled "My Computer"?
User: Your left or my left?
Helpdesk: On the left of your screen. Double click on it.
User: What's your computer doing on mine?

jameswsparker
01-31-2011, 09:59 AM
Please refer to http://www.codingforums.com/showthread.php?t=216963