The JavaScript case statement enables one of a series of actions to be chosen, given the value or an expression.
Consider the IF clause:
If (Style == 'parent') {
//actions associated with this menu style.
} //(Style == 'parent')
This may be extended to provide an exception if this is not true:
If (Style == 'parent') {
//actions associated with this menu style.
}//(Style == 'parent')
else {
//Other actions
} //(Style == 'parent')
This becomes cumbersome, if we are to cater for further possible results.
An alternative is to use the Case Statement (in JavaScript this is implemented using switch).
We test using the Switch statement and then provide a number of case options, finally a default option to catch anything that had slipped through our clauses.
switch (slStyle) {
case 'Sliding':
//actions for the Sliding style
case 'Rotating' :
//actions for the Rotating style
default:
//actions for any other option selected
}


