代码有什么错误呢?错误信息显示ErrorNotification.js

  错误提示:

ErrorNotification.js:125 Cannot assign Ctrl-Shift-Down to io.emmet.decrement_number_by_1. It is already assigned to edit.lineDown

<script type="text/javascript">
   function count(){
    var a1=parseInt(document.getElementById('txt1').value);
    var a2=parseInt(document.getElementById('txt2').value);
    var guize=document.getElementById('select').value;
       var result=0;

        switch(guize){
            case '+':
                result=a1+a2;
                break;
            case '-':
                result=a1-a2;
                break;
            case '*':
                result=a1*a2;
                break;
            default:
                result=a1/a2;
                break;
        }
        document.getElementById('fruit').innerHTML=result.toString();
    }
  </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=' = ' onclick='count()'/> <!--通过 = 按钮来调用创建的函数,得到结果-->
   <input type='text' id='fruit'/>  
 </body>
</html>

_Capricornna
浏览 1432回答 1
1回答

慕粉3591791

document.getElementById('fruit').innerHTML=result.toString();==>document.getElementById('fruit').value=result
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5