I'm having trouble with a JavaScript timed-output that states some type of greeting and then the time. Code:
<script language="Javascript">
<!--
{
var now = new Date();
var h = now.getHours();
var m = now.getMinutes();
var s = now.getSeconds();
if (hours < 7){timemsg = "Wakey wakey, Mr. Person. The time is: " + hours + ':' + minutes + ':' + seconds};
if (hours > 6 && hours <12){timemsg = "Good morning, Mr. Person. The time is: " hours + ':' + minutes + ':' + seconds};
if (hours > 11 && hours <18){timemsg = "Good afternoon, Mr. Person. The time is: " hours + ':' + minutes + ':' + seconds};
if (hours >17){timemsg = "Good evening, Mr. Person. The time is: " hours + ':' + minutes + ':' + seconds};
document.write(timemsg)};
// -->
</script>
The expected output should go something like this: Wakey Wakey,/Good morning/afternoon/evening, Mr. Person. The time is: (time).