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; }
路人丶丨
相关分类