function count() {
var txt1=document.getElementById('txt1').value;
var txt2=document.getElementById('txt2').value;
var select=document.getElementById('select').value;
var result='';
switch (select){
case '+':
result=parseFloat(txt1)+parseFloat(txt2);
break;
case '-':
result=parseFloat(txt1)-parseFloat(txt2);
break;
case '*':
result=parseFloat(txt1)*parseFloat(txt2);
break;
case '/';
result=parseFloat(txt1)/parseFloat(txt2);
}
document.getElementById('fruit').value = result;
}
添加回答
举报
0/150
提交
取消