Syntax for IF Statement
<script type="text/javascript">
<!--
var result= 20;
if( result> 18 ){
document.write("<b>Result is greater than 18</b>");
}
//-->
</script>
Syntax for IF Else Statement
<script type="text/javascript">
var result= 20;
if( result> 18 ){
document.write("<b>Result is greater than 18</b>");
}
else
{
document.write("<b>Result is less than 18</b>");
}
</script>
Syntax for IF...Else..IF Statement
<script type="text/javascript">
var result= 20;
if( result> 18 ){
document.write("<b>Result is greater than 18</b>");
}
else if(result==18)
{
document.write("<b>Result is equal to 18</b>");
}
else
{
document.write("<b>Result is less than 18</b>");
}
</script>
No comments:
Post a Comment