| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| DesignersTalk > Java script to change image according to time of day |
|
LinkBack | Thread Tools | Search this Thread |
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Jun 2008
Posts: 11
|
I can think of a few ways, but can you give me more details? Do you want to do this only on load or if a person has been sitting idle from like say 3:48 and 4:00 rolls around, have it change. What type of frequency are we talking about? Night and evening? |
|
|
|
#4 (permalink) |
|
Senior Member
|
I want it to change say At 8:30am 10am Noon 2:30pm 4:30pm I want an image to load according to the time. Even if someone has their browser open at the time of the change. I want it to be as simple as possible, Java, or Actionscript is the only thing I can use for it. |
|
|
|
#5 (permalink) | |
|
Registered User
|
Quote:
Why would that be necessary? It's not like somebody is going to leave the website pulled up on their computer on the same page for a whole day. I'd say use server-side scripting for your best bet. |
|
|
|
|
#7 (permalink) |
|
id
Join Date: May 2008
Location: Ottawa
Posts: 217
|
With a combo of datejs (www.datejs.com)and simple DOM manipulation you should be able to get what you're after relatively easy. PSEUDO CODE Code:
|
|
|
|
#8 (permalink) |
|
Everything is fine.
|
Have an array with every hour in it and with that hour associate an image... $hours[0] => "pic1.jpg" $hours[1] => "pic2.jpg" ... Then, extract the hour from the current time and link it to that array. You could use a server-side script, or, a pure JavaScript solution would be adequate enough. If you used JS then you could use AJAX to update the time every X minutes and that in effect would update it live as the hour(s) pass. |
|
|
|
#9 (permalink) |
|
For all your goober needs
Join Date: Dec 2004
Location: Coventry, UK
Posts: 1,531
|
multiple stylesheets in conjunction with this A List Apart: Articles: Alternative Style: Working With Alternate Style Sheets Time is really the only capital that any human being has, and the one thing that he can’t afford to lose. - Thomas Edison
prem ghinde |
|
![]() |