Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Statements
STATEMENT: if...else
if
(condition) {statements1}
[else
{statements2}]
The
if...else
statement executes one set of statements if a specified condition is true, and another if it is false.
The following example tests the result of a function and displays one of two messages depending on whether the result is less than 10 or not:
Code:
if(calcaverage(x,y,z) < 10)
document.write("The average is less than 10.");
else
document.write("The average is 10 or more.");
NOTE:
You shouldn't use simple assignment statements such as
if(a = b)
in a conditional statement.
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information