Javascripts > Javascript Clocks > Time Message
Script Title: Time Message
Description: Gives the user a special greeting according to what time it is.
Example: Available
Copy the following code into your <HEAD></HEAD> tags.<SCRIPT language=javascript> var date = new Date(); var hours = date.getHours(); if (hours > 0 && hours < 12) { alert("Good Morning!"); } else if (hours >=12 && hours < 18) { alert("Good Afternoon!"); } else if (hours > 18 && hours < 21) { alert("Good Evening!"); } else if (hours > 21 && hours < 0) { alert("Good Night."); } </SCRIPT>
Enter your name and email address to have this script sent right to your Inbox for later viewing. First Name Last Name Email