Electricity Suppliers - Loans - Auto Loans - Fast Loans - UK Renault car dealers

PDA

View Full Version : Prompt Help


soapgurl21
Feb 5th 2008, 5:04 pm
I need help with a prompt that says:
"Specify the operation you want the machine to perform
a Simple Math calculation
b Simple Physics formulae
c Quote of the Day"

That part I have down but I want it so that when they enter "a" JavaScript uses compute_Math_op(), "b" compute_Physical_quantities, or "c" quote_of_the_day() function.

Thus far I have
<script type="text/javascript">
var y = prompt("Specify the operation you want the machine to
perform /n a Simple Math calculation /n b Simple Physics formulae /n c
Quote of the Day","");
switch(x){

case ‘a’: compute_Math_op();
break;
case ‘b’: compute_Physical_quantities();
break;
case ‘c’: quote_of_the_day();
break;
}
</script>
Really appreciate any help.
Thanks

nhl4000
Feb 5th 2008, 6:25 pm
<script type="text/javascript">
var y = prompt("Specify the operation you want the machine to
perform /n a Simple Math calculation /n b Simple Physics formulae /n c
Quote of the Day","");
switch(y){
case ‘a’:
compute_Math_op();
break;
case ‘b’:
compute_Physical_quantities();
break;
case ‘c’:
quote_of_the_day();
break;
}
</script>

Isn't it suppose to be switch(y)?

MMJ
Feb 7th 2008, 7:46 am
var y = prompt('Specify the operation you want the machine to perform:'
+'\n a Simple Math calculation'
+'\n b Simple Physics formulae'
+'\n c Quote of the Day', '');
switch(y){
case 'a':
compute_Math_op();
break;
case 'b':
compute_Physical_quantities();
break;
case 'c':
quote_of_the_day();
}