This forum is in permanent archive mode. Our new active community can be found here.

JavaScript problem

edited May 2008 in Technology
As a beginner to this programming language I have a question: Why is the following script not working?

var now = new Date();
var hour = now.getHours();
if (hour >= 0 && hour <= 12) {
document.write("<img src='http://www.makushimirian.com/projects/java/img/ohayou.jpg'>");
}
if (hour > 12 && hour <= 18) {
document.write("<img src='http://www.makushimirian.com/projects/java/img/konnichiwa.jpg'>");
}
if (hour > 18) {
document.write("<img src='http://www.makushimirian.com/projects/java/img/konbanwa.jpg'>");
}


Heres the HTML where it's supposed to be outputted.
Sign In or Register to comment.