JavaScript Tutorial - 4 - a possible answer to Task 8 <html> <head> <title>Greetings</title> </head> <body> <script> document.write("<font size=6 color=#ff6600>") document.write("<i>") var now=new Date() var hour=now.getHours() var s="Good Morning" if (hour>11) { s="Good Afternoon" } if (hour>16) { s="Good Evening" } document.write(s) document.write("</i>") document.write("</font>") </script> </body> </html>

HOME Table of Contents