value 能用innerHTML代替吗
function count(){
var t1 = parseInt(document.getElementById("txt1").value);
//获取第一个输入框的值
var t2 = parseInt(document.getElementById("txt2").value);
//获取第二个输入框的值
var flag = document.getElementById("select").value;
//获取选择框的值
var result = "";
switch(flag) {
case "+":
result = t1 + t2;
break;
case "-":
result = t1 - t2;
break;
case "*":
result = t1 * t2;
break;
case "/":
result = t1 / t2;
break;
}
//获取通过下拉框来选择的值来改变加减乘除的运算法则
document.getElementById("fruit").value = result;
//设置结果输入框的值
}