Another switch Statement : Switch : Language Basics JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Language Basics » Switch »

 

Another switch Statement



<HTML>
<HEAD>
<TITLE>Using the switch Statement</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript"><!--
for(i=1; i<=10; ++i) {
 switch (i) {
  case 1:
   val = "one"
   break;
  case 2:
   val = "two"
   break;
  case 3:
   val = "three"
   break;
  case 4:
   val = "four"
   break;
  case 5:
   val = "five"
   break;
  case 6:
   val = "six"
   break;
  case 7:
   val = "seven"
   break;
  case 8:
   val = "eight"
   break;
  case 9:
   val = "nine"
   break;
  case 10:
   val = "ten"
   break;
  default:
   val = "unknown"
 }
 document.writeln(val+"<BR>");
}
// -->
</SCRIPT>
</BODY>
</HTML>

           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Language Basics
» Switch