Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











STATEMENT:  switch


switch
 
The switch statement tests an expression against a number of case options and executes the statements associated with the first one to match. If no match is found, the program looks for a set of default statements to execute, and if these aren't found either, it carries on with the statement immediately following switch. An optional break statement with each case ensures that once a set of statements has been executed, the program exits switch. If break were omitted, the statements associated with the following case would also be executed:
 
Code:
switch (i)
{
   case "Chicago" :
      document.write ("Flights to Chicago: Saturdays.");
      break;
   case "London" :
      document.write ("Flights to London: Fridays.");
      break;
   case "New York" :
      document.write ("Flights to New York: Fridays.");
      break;
   case "San Francisco" :
      document.write ("Flights to San Francisco: Wednesdays.");
      break;
   default :
      document.write ("Sorry, there are no flights to " + i + ".<BR>");
}
document.write("Thank you for enquiring with Northern Airlines.<BR>");

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information