May 6, 2013

If Else statement in JavaScript


<script language="JavaScript">
var d = new Date()
var time = d.getHours()
if (time < 10)
document.write("<b>Good morning</b>")
document.write("<b>Good day</b>")
This example demonstrates the If...Else statement.<p>If the time on your browser is
less then 10, you will get a "Good morning" greeting. Otherwise you
will get a "Good day" greeting.

No comments:

Post a Comment

Popular Posts