var num1 = 123;
var num2=123;
var sum = num1+num2;
结果是246;
<input type="text" id="txt1" value="123" />
<input type="text" id="txt2" value="123" />
var num1= $("#txt1").val();
var num2 = $("#txt2").val();
var sum= num1+num2;
结果是123123;
var sum= num1*1+num2*1;
结果是246;