为什么这种方法实现不了,还请解答,谢谢
//方法一:
function count(){
var a=document.getElementById("txt1").value;
var b=document.getElementById("txt2").value;
var c=document.getElementById("fruit").value;
var selecting=document.getElementById("select").value;
switch(selecting){
case "+":
c.setAttribute("value",parseInt(a)+parseInt(b));
break;
case "-":
c.setAttribute("value",parseInt(a)-parseInt(b));
break;
case "*":
c.setAttribute("value",parseInt(a)*parseInt(b));
break;
case "/":
c.setAttribute("value",parseInt(a)/parseInt(b));
break;
}
}
为什么这种方法实现不了,还请解答,谢谢