j结果的问题
两个数计算的结果怎么出不来呢
两个数计算的结果怎么出不来呢
2019-03-10
function count(){
var aa = parseInt(document.getElementById("txt1").value);
console.log(aa)
//获取第二个输入框的值
var aa1 = parseInt(document.getElementById("txt2").value);
//获取选择框的值
var sel = document.getElementById("select").value;
console.log(sel);
var sum1;
switch(sel)
{
case "+":
sum1 = aa+aa1;
break;
case "-":
sum1 = aa-aa1;
break;
case "*":
sum1 = aa*aa1;
break;
case "/":
sum1 = aa*aa1;
break;
}
document.getElementById("fruit").value = sum1;
}
举报