为什么只能执行加法运算,减乘除都无效
<script type="text/javascript">
function count(){
var mychar1=document.getElementById("txt1").value;
//获取第一个输入框的值
var mychar2=document.getElementById("txt2").value;
//获取第二个输入框的值
var myselect=document.getElementById("select").value;
var result="";
//获取选择框的值
switch(myselect){
case "+":
result= parseInt(mychar1)+parseInt(mychar2);
break;
case "-":
result= parseInt(mycha1)-parseInt(mychar2);
break;
case "*":
result= parseInt(mycha1)*parseInt(mycha2);
break;
case "/":
result= parseInt(mychar1)/parseInt(mychar2);
break;
default:
null;
}
//获取通过下拉框来选择的值来改变加减乘除的运算法则
//设置结果输入框的值
document.getElementById("fruit").value=result;
}
</script>