Thursday 25 April 2013

gm ge gn


Print GM a/c to date n time
<html>
 <head>
  <title> Experiment No 6(c 2) </title>
 </head>

 <body>
  <center>
<h5>Implement a javascript  by using date object print GOOD MORNING as per the current date or time.display complete date </h5>

<form>
<input type="button" value="Display" onclick="disp()">

<script type="text/javascript">
function disp()
{
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10)
{
minutes = "0" + minutes
}
document.write("<h4>It is now "+ hours + ":" + minutes + " ")

if(hours > 11)
{
document.write("PM")
}
else
{
document.write("AM")
}
if (minutes <= 59 && hours < 12 )
{
document.write("<h1>Good Marning !!!!!!! </h1>")
}
else if (minutes <= 59 && hours > 12 && hours < 16 )
{
document.write("<h1>Good Afternoon !!!!!!! </h1>")
}
else if (minutes <= 59 && hours > 16 && hours <= 23 )
{
document.write("<h1>Good Evening !!!!!!! </h1>")
}
}
</script>

</form>
  </center>
 </body>
</html>

No comments:

Post a Comment