Haha, sorry that's my mistake actually, because this happens when the page loads the work on the image is done before the image is created... So lets go about it slightly differently (using the dynamic creation method idea proposed by the script)...
Code:
<script type="text/javascript">
//Time of day message script- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use
var Digital=new Date()
var hours=Digital.getHours()
//Configure message below to your own.
//create an image object
var theImg = document.createElement("img");
//give it properties(uncomment these and modify as necessary)
//theImg.style.width="100px";
//theImg.style.height="100px";
//add the image to the document
document.body.appendChild(theImg);
//set the source of the image appropriately
if (hours>=5&&hours<=11) //MESSAGE FOR MORNING
theImg.src = "morningPic.jpg";
else if (hours==12) //MESSAGE FOR NOON
theImg.src = "noonPic.jpg";
else if (hours>=13&&hours<=17) //MESSAGE FOR AFTERNOON
theImg.src = "afternoonPic.jpg";
else if (hours>=17&&hours<=19) //MESSAGE FOR EVENING (6pm-8pm)
theImg.src = "eveningPic.jpg";
else if (hours>=18&&hours<=11) //MESSAGE FOR NIGHT (9pm-11pm)
theImg.src = "nightPic.jpg";
else //MESSAGE FOR LATE NIGHT, EARLY MORNING (12pm-4am)
theImg.src = "earlymorningPic.jpg";
</script>
Put that in the body of your page where you want the image to appear and it'll work fine.
Quote:
|
sorry thats a bit rude asking you to practicly do it for me
|
Don't worry =] You made a good go of it, and that's all we ask =]
Cheers,
Jamey