Give me the entire code of your page(from HTML to /HTML) and i'll see what's going wrong. It should be:
Code:
<script type="text/javascript">
But yeah, post your code, in [code] tags(so that it looks like that^), and i'll take a look over the script, but i got it working as:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Testing</title>
</head>
<body>
<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>
</body>
</html>
Did you make sure the images were labelled correctly? (And expand on "doesn't work", does it just not show the image?)
Cheers,
Jamey