Page 318 - Web Applications (803) Class 11
P. 318
Example: To display one of the two alternate messages.
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE> if-else statement </TITLE>
</HEAD>
<BODY>
<SCRIPT>
var my_score = parseInt(prompt(“Enter a score”));
passing_score = 60;
if(my_score >= passing_score)
{
alert(“Congratulations on passing the exam”);
}
else
{
alert(“You failed, try harder next time”);
}
</SCRIPT>
</BODY>
</HTML>
Output:
When you click on the “OK” button, with the message “this page says”. Then a new window opens, as shown below:
316 Touchpad Web Applications-XI

