错误提示: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>
1 回答
已采纳
慕粉3591791
TA贡献1条经验 获得超1个赞
document.getElementById('fruit').innerHTML=result.toString();==>document.getElementById('fruit').value=result
- 1 回答
- 0 关注
- 1426 浏览
添加回答
举报
0/150
提交
取消