<script type ="text/javascript">
var num1 = prompt("请输入第一个数" ",");
var num2= prompt("请输入第二个数" ",");
var method= prompt("请输入运算符" ",");
functiona(){
swich(method){
case " * ":
alert(num1 * num2);
case " / ":
alert(num1 / num2);
case " + ":
alert(num1 + num2);
case " - ":
alert(num1 - num2);
}
}
<script/>
<input name = "btn" type = "butten" value ="计算机" onclick "a()"/>
时间: 2024-12-21 10:30:49