JavaScript Source Code 3000: Page Details: Time Greeting
Time Greeting
Don't just welcome your visitors anymore, JavaScript can write good morning, good evening, or good afternoon based on the time the page was loaded, according to the user's system clock. Neat!
JavaScript Source Code 3000: Page Details: Time Greeting Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!
<!-- ONE STEP TO INSTALL TIME GREETING:
1. Copy the coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the BODY of your HTML document -->
<BODY>
<SCRIPT LANGUAGE="JavaScript"> <!-- Original: Robert Ison --> <!-- Web Site: http://www.infosourcetraining.com -->
<! > <! >
<!-- Begin datetoday = new Date(); timenow=datetoday.getTime(); datetoday.setTime(timenow); thehour = datetoday.getHours(); if (thehour > 18) display = "Evening"; else if (thehour >12) display = "Afternoon"; else display = "Morning"; var greeting = ("Good " + display + "!"); document.write(greeting); // End --> </script>