//加法函数function jiafa(a,b){ var a=parseInt(document.getElementById("number1").value); //parseInt()把文本转为Int类型 var b=parseInt(document.getElementById("number2").value); var c=a+b; //减法、乘法、除法同理 document.getElementById("sum1").value=c; }效果如下(可试用):+ =
+ =