Message Based Upon Time

[Total: 0    Average: 0/5]

This will write a message based upon the time of day.

Body Code:

<script language="JavaScript">
function greeting() {
Now = new Date()
Hour = Now.getHours();
if (Hour < 5)
msg ="<H4>GOOD NIGHT !</H4>"  
else if(Hour <12)
msg ="<H4>GOOD MORNING !</H4>"
else if(Hour < 18)
msg ="<H4>GOOD DAY !</H4>"
else if (Hour < 24)
msg ="<H4>GOOD EVENING !</H4>"
return( msg )
}

document.write(greeting())
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *