andrew1234
11-13-2002, 09:02 AM
Hi
can anyone please tell me why the second script does not work
script 1 shows
that variable fred =1 so the alert in case 1: shows
but in the second
script i used a fred=prompt("hello",1)
but this one goes and displays the default alert("nothing")
why won't this script show its class 1:
thanks
andrew
---------------------------------------------script 1
<script language="javascript">
var fred=1
switch (fred)
{
case 1:
alert("rad");
break;
case 6:
alert("cool");
break;
case 9:
alert("radical");
break;
//default:
//alert("nothing");
//break;
}
</script>
--------------------------------------------------script 2--
<script language="javascript">
var fred
var fred=prompt("hello",1);
switch (fred)
{
case 1:
alert("yeah bady");
break;
case 6:
alert("cool");
break;
case 9:
alert("radical");
break;
default:
alert("nothing");
}
</script>
can anyone please tell me why the second script does not work
script 1 shows
that variable fred =1 so the alert in case 1: shows
but in the second
script i used a fred=prompt("hello",1)
but this one goes and displays the default alert("nothing")
why won't this script show its class 1:
thanks
andrew
---------------------------------------------script 1
<script language="javascript">
var fred=1
switch (fred)
{
case 1:
alert("rad");
break;
case 6:
alert("cool");
break;
case 9:
alert("radical");
break;
//default:
//alert("nothing");
//break;
}
</script>
--------------------------------------------------script 2--
<script language="javascript">
var fred
var fred=prompt("hello",1);
switch (fred)
{
case 1:
alert("yeah bady");
break;
case 6:
alert("cool");
break;
case 9:
alert("radical");
break;
default:
alert("nothing");
}
</script>