Make sure to include the "break" command if you want the switch statement to exit once a match is found:
Code:
<script type="text/javascript"> //<![CDATA[ time_zone = "central"; switch (time_zone) { case "eastern": { document.write("So you're an east coast type, eh?"); break; } case "central": { document.write("How's that midwestern weather been lately?"); break; } case "mountain": { document.write("Are you a mountain man, or a mountain woman?"); break; } case "pacific": { document.write("A pacifist, I see."); break; } default: { document.write("Where are you from, anyway?"); } } //]]> </script>
Output: