運(yùn)行不出來
? function count(){
? ? ? var a=parseInt(document.getElementById('txt1').value);
?
? ? var b=parseInt(document.getElementById('txt2').value);
? ? var x=document.getElementById('selsect').value;
? function count(){
? ? ? var a=parseInt(document.getElementById('txt1').value);
?
? ? var b=parseInt(document.getElementById('txt2').value);
? ? var x=document.getElementById('selsect').value;
2016-08-28
舉報
2016-08-29
這個和我發(fā)的有什么區(qū)別嗎?
2016-08-28
function count(){
? ? ? var mytxt1=document.getElementById("txt1").value;
? ? ? var mytxt2=document.getElementById("txt2").value;
? ? ? var mys=document.getElementById("select").value;
? ? ? var result="";
? ? ? switch(mys)
? ? ? {
? ? ? ? ? case "+":
? ? ? ? ? ? ? result=parseFloat(mytxt1)+parseFloat(mytxt2);
? ? ? ? ? ? ? break;
? ? ? ? ? ? case "-":
? ? ? ? ? ? ? result=parseFloat(mytxt1)-parseFloat(mytxt2);
? ? ? ? ? ? ? break;
? ? ? ? ? ? case "*":
? ? ? ? ? ? ? result=parseFloat(mytxt1)*parseFloat(mytxt2);
? ? ? ? ? ? ? break;
? ? ? ? ? ?case "/":
? ? ? ? ? ? ? result=parseFloat(mytxt1)/parseFloat(mytxt2);
? ? ? }
? ? ? document.getElementById("fruit").value=result;
? ?}