function calculate()
{
var num1 = document.getElementById("input1").value;
var num2 = document.getElementById("input2").value;
var operator = document.getElementById("operation");
var totalNum = document.getElementById("total");
if (operator == "+")
{
parseDouble(totalNum = num1 + num2);
}
else if(operator == "-")
{
parseDouble(totalNum = num1 - num2);
}
total.value = totalNum;
}
我的输出是 [object HTMLInputElement]。如何区分数学运算??