Tryit Editor v1.4

<html> <body> <script type="text/javascript"> var d = new Date(); var time = d.getHours(); if (time < 10) { document.write("<b>Good morning</b>"); } </script> <p> This example demonstrates the If statement. </p> <p> If the time on your browser is less than 10, you will get a "Good morning" greeting. </p> </body> </html> | Your Result:
Edit the code above and click to see the result. | W3Schools.com - Try it yourself