<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <script type="text/javascript"> var owe=prompt("计算第一个值",""); var oee=prompt("计算第二个值",""); var oae=prompt("请输入运算符",""); var sk; a=parseFloat(owe); d=parseFloat(oee); switch(oae){ case "+": sk=a+d; break; case "-": sk=a-d; break; case "*": sk=a*d; break; case "/": sk=a/d; break; } alert("计算的数字是"+a+oae+d+"="+sk); </script> <body> </body> </html>