Load page based on day of week

Wipeout

Limp Gawd
Joined
Sep 12, 2002
Messages
271
Trying to do something that I thought was simpler than it's turning out to be. I've "inherited" an internal website here at work and am trying to play in the original person's sandbox.

I have pages for each day of the week (monday.html, etc) that have content on them. Instead of changing the link to the page manually each day, I wanted to automatically change the link based on the current day of the week. So, if it's Monday, link to monday.html; Thursday to thursday.html, etc. The page that has the link is ASP, but I'm a total ASP noob.

Is what I'm trying to do possible/feasible?
 
Have the link point to a JavaScript redirect page. The entire contents of that page would be something like:
Code:
<html><script language="JavaScript">
var DaysofWeek= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
today=new Date() 
thisDay=today.getDay()
window.location='http://www.url.com/' + DaysofWeek[thisDay] + '.html'
</script></html>
And then set up different pages for each day of the week. It'll auto-redirect based on the user's clock.

Or you could modify it and put that all in your original page's source code, and then the link would automatically change every day instead of the redirect page.
 
I wouldn't do this on the client side using JavaScript. A couple of things could go wrong here,1) User has JS disabled 2) Their system clock is wrong. I would stick to redirecting/including the proper page on the server.
 
Thanks guys - we actually have a tool that REQUIRES java here at work and as a result, everyone has javascript. I'd rather do it server-side, however. This gives me some ideas, at least. :)
 
Back
Top