Write a script that displays the message “Good Morning”, “Good afternoon” and “Good Evening” in a separate window according to time of the day?



<html>
<head><title>date Example</title>
<script language="Javascript">
function wish()
{
d=new Date();
hr=d.getHours();
if(hr<12)
alert("good morning");
else if(hr>=12 && hr<17)
alert("good afternoon");
else
alert("good evening");
}
</script>
</head>
<body>
<input type= "button" value="test" OnClick="wish()">
<hr>
</body>
</html>

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart