<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>
|