<!DOCTYPE html>
<html>
 <head>
  <title> 事件</title>  
  <script type="text/javascript">
   function count(){
       var num1=parseInt
       (document.getElementById("txt1").value);
       var num2=parseInt
       (document.getElementById("txt2").value);
       var doselect=
       document.getElementById("select");
       var index=doselect.selectedIndex;
       var option=doselect.option[index].value;
       var num3=document.getElementById("fruit").value;
       switch(option){
        case"+":
            num3=num2+num1;
            break;
        case"-":
            num3=num1-num2;
            break;
        case"*":
            num3=num1*num2;
            break;
        case"/":
            num3=num1/num2;
            break;
       }
    //获取第一个输入框的值
    //获取第二个输入框的值
    //获取选择框的值
    //获取通过下拉框来选择的值来改变加减乘除的运算法则
    //设置结果输入框的值 
    
   }
  </script> 
 </head> 
 <body>
   <input type='text' id='txt1' /> 
   <select id='select'>
        <option value='+'>+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
   </select>
   <input type='text' id='txt2' /> 
   <input type='button' value=' = ' conclick="count()"/> <!--通过 = 按钮来调用创建的函数,得到结果--> 
   <input type='text' id='fruit' />   
 </body>
</html>
var option=doselect.options[index].value; 这里是options
<input type='button' value=' = ' conclick="count()"/> <!--通过 = 按钮来调用创建的函数,得到结果-->你这的事件用的是 conclick 没有前面的c 应该是onclick
case"+":
            num3=num2+num1;
document.getElementById("fruit").value = num3;
break;
拿到值后要重新赋值
这样跟你说吧 你定义的变量只是取到了值 然后拿去运算啥的 这个时候 这个值是变了 但是 html页面这个节点他不会更新 你得把数据给他重新绑定