
为什么减法算出来没有值,除法算出来是“undefined"?
switch里的值是哪来的,根据上面应该是变量c,或者把上面的变量c改成select.
参考代码
 function count(){
    	var txt1   = parseInt( document.getElementById('txt1').value);//获取第一个输入框的值
		var txt2   = parseInt( document.getElementById('txt2').value);//获取第二个输入框的值
		var select = document.getElementById('select').value;//获取选择框的值
		var F = '';
		switch (select)
		 {
			case '+':
				F = txt1 + txt2;
				break;
			case '-':
				F = txt1 - txt2;
				break;
			case '*':
				F = txt1 * txt2;
				break;
			case '/':
				F = txt1 / txt2;
				break;  
		 }
         document.getElementById('fruit').value = F;//设置结果输入框的值 
   }select从哪来的?