Page 358 - Webapplication11_C11_Flipbook
P. 358
if(num > 0)
{
document.write("Entered Number is Positive");
}
</SCRIPT>
</BODY>
</HTML>
On running the above program, we get the following output:
When you click on the “OK” button, with the message “this page says”. Then a new window opens, as shown below:
Example:
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE> if statement </TITLE>
</HEAD>
<BODY>
<SCRIPT>
var days = parseInt(prompt("How many days are there in a leap year?"));
if(days == 366)
{
document.write("Your answer is correct, Good Job.");
}
</SCRIPT>
</BODY>
</HTML>
356 Touchpad Web Applications-XI

