Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- </head>
- <body onload="time()">
- </body>
- <footer>
- <script src="jquery-2.2.4.js">
- $(function(){
- function time() {
- var rightNow = new Date();
- var hour = rightNow.getHours();
- switch(true)
- {
- case (hour >= 8 && hour < 12):
- alert('Good morning!');
- break;
- case (hour >= 12 && hour < 18):
- alert('Good afternoon!');
- break;
- case (hour >= 18 && hour < 24):
- alert('Good evening!');
- break;
- default:
- alert('You should be sleeping!');
- break;
- }
- }
- });
- </script>
- </footer>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement