If Statement

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email
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>")
document.write("You have failed the exam")

}
//-->
</script>
</head>
</html>



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.