Page 316 - Web Applications (803) Class 11
P. 316
When you click on the “OK” button, with the message “this page says”. Then a new window opens, as shown below:
Do You Know?
In JavaScript, the non-zero value is interpreted as true and 0 is
interpreted as false.
The if…else Statement
The if…else statement checks for a condition. If the condition evaluates to True, the indented block following the if
statement is executed, otherwise the indented block after the else statement is executed. The syntax of the if… else
statement is given below:
if (condition)
{
// When the condition is true then block of code to be executed.
}
else
{
// When ’if’ statement condition is false then block of code to be executed.
}
Flow diagram:
Start
if condition
False
True
Statements else statements
Stop
Example:
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE> if-else statement </TITLE>
314 Touchpad Web Applications-XI

