Previous
If Condition 
Next
For Loop 
ABC of JavaScript : An Interactive JavaScript Tutorial
Switch Case

Switch Case

Syntax:
switch (VARIABLE) {
case CONDITION : STATEMENT
break
case CONDITION : STATEMENT
break
case CONDITION : STATEMENT
break
default : STATEMENT
}

This has a similar function as the If condition - but it is more useful in situations when there is many possible values for the variable. Switch will evaluate one of several statements, depending on the value of a given variable. If no given value matches the variable, the default statement is executed.

Previous
If Condition 
Next
For Loop 

Comments

swathi at 26 Feb, 2009 11:42
hi how can i write a switch case statement where i can use that to check multiple conditions.

suppose i have seven check boxes named mon tue----sun of a week

and i need a switch case which checks for the o/p and executes the perticular case even if a person clicks two boxes named mon and wed it should check them and process the statements

how can i do this

you can mail the answer to me

any help
Reply to this.
Comment

Please dont enter you comments in this form - this is a fake form to confuse spamming bots. The next form is the real one.




Comment




Comment Formating : HTML tags a, strong, em, b, i, code, pre, p and br allowed. Other tags will be shown as code(< will become &lt;). Urls, Line breaks will be auto-formated.