![]() |
If Statement![]() ![]() ![]() ![]() ![]()
The block of statements is executed only if the condition becomes true or else the code is skipped. In case if you want to execute a block of code when the condition fails then we can use the else format. The syntax for using else format is:if(condition){ block of statements }else{ another block of statements } Example <html> <head> <title>My First JavaScript Program</title> <script Language="JavaScript"> <!-- marks=60 it (marks >= 60){ document.write("Welcome to Pentasoft" +"<br") document.write("This line is printed if the condition is true") document.write("You have passed the exam") }else{ document.write("Good Bye"+"<br>) document.write("This line is printed if the condition is false"+"<br>") }
|
|
Domain NamesJAVASCRIPT Types of Variables Arrays Data Type Conversion Arithmetic Operators Logical and Comparison Operators Assignment Operators Ternary Operators Operator Precedence Assignment Statements If StatementsSwitch Statement Function Call Statement Try, Catch and Throw Statements The For Loop Java While Loop The Do While Loop Break and Continue Statements
String Methods Array Methods Objects, Methods and Properties The Boolean Object The Date Object The Global Object The Math Object
The Number Object Color Constants Hierarchy of Browser Objects Window Object Document Object History Object Navigator Object Buttons Check Box Radio Buttons Text FieldsWorking with Image Maps Creating Simple Animation Hidden Fields Working with Style Sheets An Example of HTML Graphics Replacement The <SPAN> Tag Positioning of HTML Content The <LAYER> TagWeb DesignWeb HostingE Commerce |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |