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

The geek forum. PHP, Perl, HTML, hardware questions etc.. it's all in here. Got a techie question? We'll sort you out. Ask your questions or post a link to your own site here!

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

Postby Destroyer2000 » Tue Mar 02, 2004 5:59 pm

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?
My Flickr
My Travel Blog

[color="Red"]Distance is to Love as Wind is to Fire...it extinguishes the small, and ignites the great. - Unknown[/color]

[color="RoyalBlue"]“Falling in love with someone isn't always going to be easy... Anger... tears... laughter.. It's when you want to be together despite it all. That's when you truly love another. I'm sure of it.â€
User avatar
Destroyer2000
 
Posts: 1756
Joined: Thu Sep 11, 2003 9:00 am
Location: Fields of Athenry

Postby andyroo » Tue Mar 02, 2004 6:46 pm

Here are two scripts that I found quckly (links below):

PHP Day and Night

24 houres Live Clock
"As vinegar to the teeth and smoke to the eyes, so is a sluggard to those who send him." ~Proverbs 10:26
†
The Ideas Behind Anime |

The difference between intelligence and stupidity is that intelligence has its limits.
A proud member of P.I.E. -- Pictures of Inkhana for Everyone! Join the fight!
User avatar
andyroo
 
Posts: 815
Joined: Tue Jun 10, 2003 11:00 am
Location: Alabama

Postby Destroyer2000 » Tue Mar 02, 2004 7:15 pm

What does PHP Day and Night do?
My Flickr
My Travel Blog

[color="Red"]Distance is to Love as Wind is to Fire...it extinguishes the small, and ignites the great. - Unknown[/color]

[color="RoyalBlue"]“Falling in love with someone isn't always going to be easy... Anger... tears... laughter.. It's when you want to be together despite it all. That's when you truly love another. I'm sure of it.â€
User avatar
Destroyer2000
 
Posts: 1756
Joined: Thu Sep 11, 2003 9:00 am
Location: Fields of Athenry

Postby andyroo » Tue Mar 02, 2004 7:53 pm

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.
"As vinegar to the teeth and smoke to the eyes, so is a sluggard to those who send him." ~Proverbs 10:26
†
The Ideas Behind Anime |

The difference between intelligence and stupidity is that intelligence has its limits.
A proud member of P.I.E. -- Pictures of Inkhana for Everyone! Join the fight!
User avatar
andyroo
 
Posts: 815
Joined: Tue Jun 10, 2003 11:00 am
Location: Alabama

Postby Mithrandir » Wed Mar 03, 2004 7:34 am

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.
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.


Return to Computing and Links

Who is online

Users browsing this forum: No registered users and 32 guests