Javascripts > Javascript Forms > Auto Greeting
Script Title: Auto Greeting
Description: You can put this in your web page to greet your site visitors according to their local time.
Example: Available
Copy the following code into your <HEAD></HEAD> tags.<SCRIPT> function getGreeting(){ var curDateTime = new Date() var curHour = curDateTime.getHours() var greeting = "Good Evening" if (curHour < 12 && curHour >= 0) greeting = "Good Morning" if (curHour >=12 && curHour < 18) greeting = "Good Afternoon" return greeting } </SCRIPT>
Copy the following code between the <BODY></BODY> tags of your html page.<SCRIPT language="JavaScript"> document.write(getGreeting()) </SCRIPT>
Enter your name and email address to have this script sent right to your Inbox for later viewing. First Name Last Name Email