Page 1 of 1

Is there a script that will...(continued, really need help)

PostPosted: Tue Mar 02, 2004 5:59 pm
by Destroyer2000
Is there a script that will change the background color of a website according to what time of the day it is? Like make it a scene of nighttime when it turns 6:00 PM?

PostPosted: Tue Mar 02, 2004 6:46 pm
by andyroo
Here are two scripts that I found quckly (links below):

PHP Day and Night

24 houres Live Clock

PostPosted: Tue Mar 02, 2004 7:15 pm
by Destroyer2000
What does PHP Day and Night do?

PostPosted: Tue Mar 02, 2004 7:53 pm
by andyroo
This is the description the authour of PHP Day and Night gave:
Supply some geographic information to this script and it returns 'day' or 'night' according to the given locations sunrise/sunset. This script shall be used for layout switches: Doing this by the hour is bad practise as it does not consider varying day lengths. Examples are included in the source code.

I think it should be able to work with backgrounds.

PostPosted: Wed Mar 03, 2004 7:34 am
by Mithrandir
I haven't looked at the ones above, but if you know JavaScript, it should be possible to do this with the JavaScript function Date() It wouldn't be too difficult to setup a series of if statements that say something like (note: this code won't work, it's for reference only):
Code: Select all
if (hour == 1)
 body.bgcolor="#FFffFF";
if (hour == 2)
 body.bgcolor="#EEeeEE";

etc.... Like I said, you'd have to know javascript to get it to work. If you can't find anything to do what you want done, let me know. I'll give you a bit more help.