慕勒4102273
2014-12-08 01:40:29
? ? switch(select){? ? ? ? case "+":? ? ? ? parseInt(txt1)+parseInt(txt2);? ? ? ? ? ? break;? ? ? ? ?case "-":? ? ? ? parseInt(txt1)-parseInt(txt2);? ? ? ??? ? ? ? ? ? break;? ? ? ? ?case "*":? ? ? ? parseInt(txt1)*parseInt(txt2);? ? ? ? ? ? break;? ? ? ? ?case "/":? ? ? ? parseInt(txt1)/parseInt(txt2);? ? ? ? ? ? break;? ? }? ? ??? document.getElementById('fruit').value=
1 回答
已采納

sadyskanashi
TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊
function a(select)
{
switch(select){
? ? ? ? case "+":
? ? ? return ?parseInt(txt1)+parseInt(txt2);
? ? ? ? ? ?
? ? ? ? ?case "-":
? ? ? return ?parseInt(txt1)-parseInt(txt2);
? ? ? ??
? ? ? ? ? ??
? ? ? ? ?case "*":
? ? ? return ?parseInt(txt1)*parseInt(txt2);
? ? ? ? ? ??
? ? ? ? ?case "/":
? ? ?return ? parseInt(txt1)/parseInt(txt2);
? ? ? ? ? ?
? ? }
}
? ? ??
? document.getElementById('fruit').value=a(select);
添加回答
舉報(bào)
0/150
提交
取消