Here is how a sample HTML file will look using this javascript. You can place the script anywhere within the opening and closing BODY tags, as long as you don't insert anything into the script! |
See what it does Grab the source See more javascripts |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> your page title </TITLE> <META NAME="Copyright" CONTENT="Copyright ©1997-1999 Charlene C. Schaar"> <META NAME="Author" CONTENT="Charlene C. Schaar aka sleepy"> </HEAD> <BODY BGCOLOR="99CCFF" TEXT="330066" LINK="003399" VLINK="660000" ALINK="660000"> Some page content--such as text and graphics--can go here! <SCRIPT> <!-- start hiding // Written by: // C. Schaar aka sleepy // http://www.geocities.com/Heartland/Hollow/1000/ var now = new Date(); var hours = now.getHours(); if (hours < 5) { document.write("Hey there night-owl!") } if (hours > 4 || < 12) { document.write("Good morning!") } else if (hours > 11 || hours < 18) { document.write("Good afternoon!") } else { document.write("Good evening!") } // stop hiding --> </SCRIPT> <!-- provide alternative for javascript disabled browsers --> <NOSCRIPT> Welcome! </NOSCRIPT> Your page content--such as text and graphics--goes here! </BODY> </HTML> |