Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- </head>
- <body>
- <script>
- var now = new Date();
- var hours = now.getHours();
- var minutes = now.getMinutes();
- var name = prompt("What is your name?");
- if(hours < 12) {
- if(hours<6) {
- document.write("<h1>Good Night ")
- }
- if(hours >=6) {
- document.write("<h1>Good Morning ");
- }
- }
- if(hours >= 12) {
- hours = hours - 12;
- if(hours < 6) {
- document.write("<h1>Good Afternoon ");
- }
- if(hours>=6) {
- document.write("<span><h1>Good Evening ")
- }
- }
- document.write(name + ", It is " + hours + ":" + minutes + " now");
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement