weird request<

liunx

Guest
I dunno how you woudl do this, but i was thinking about making the background a different colour due to the time of day, so if it was 12 midnight it would be a dark background and if it was 12 am it would be a light background, (but only effected the background) and did it atomatically, any ideas?. i dunno if you owuld do it with a different script like java or something, but i dont want a random background i want a spersific background at a certain timeyou would need to use javascript, php, asp or perl for thatright say i used php, what kinda code would i have to use (ill re name topic so they move this)write code that check the day's date, if it's between somedate and somedate put this background, etc....:rolleyes:Keep in mind that you'll have to change your font colours, maybe some images, etc... so they don't contrast incorrectly with your new background colour. At midnight, while your background would change, you'd have to change other things to make sure it all remained viewable.

But it's certainly do-able, and not really that hard if you work out what needs to be changed.This would be very simple:

<html>
<head>
<?php
$hour = date("H");
if ($hour == 0) { // This is what happens if its midnight
?>
<style type="text/css">
BODY { background-color: black; font-family: sans-serif; color: white; }
</style>
<?
}

elseif ($hour == 11) { // This is what happens if its 11am
?>
<style type="text/css">
BODY { background-color: red; font-family: sans-serif; color: black; }
</style>
<?
}

else { // This is what happens for any other time
?>
<style type="text/css">
BODY { background-color: white; font-family: sans-serif; color: black; }
</style>
<?
}
?>

</head>
<body>
This is a test
</body>
</html>

The time format is in 24 hour so 23 is 11 PM. So all you would have to do is define the if condition in the above script.
 
Back
Top