jslady
05-14-2003, 06:39 AM
hi,
The switch statement below only returns the default case label. When i input the number "100" into the prompt, i still get the instructions for the default.
Is the switch statement just not flexible work like this, or have i missed something out.
thanks.
<html><head>
<script language="javascript">
var answer = prompt ("gimme number","");
var testme ="";
switch (testme){
case 100: {
document.write ("this is the 100");
break;
}
default: {
document.write ("this is the default");
}
}// close the switch
</script>
</head><body></body></html>
The switch statement below only returns the default case label. When i input the number "100" into the prompt, i still get the instructions for the default.
Is the switch statement just not flexible work like this, or have i missed something out.
thanks.
<html><head>
<script language="javascript">
var answer = prompt ("gimme number","");
var testme ="";
switch (testme){
case 100: {
document.write ("this is the 100");
break;
}
default: {
document.write ("this is the default");
}
}// close the switch
</script>
</head><body></body></html>