In this Javascript tutorial you will learn how to take two numbers that are entered by a user into a textbox, add them together, and then output the result.
http://nathanneil.com/2011/03/javascript-adding-two-variables/
Original source
In this Javascript tutorial you will learn how to take two numbers that are entered by a user into a textbox, add them together, and then output the result.
http://nathanneil.com/2011/03/javascript-adding-two-variables/
Original source
13 responses to “Javascript: Adding Two Variables”
Does it is the latest teqnique
bless your soul
i tried it…bt using number it didnt work….!/?
How to add this numbers $10 + $20 = $30. (Dollar format)
Hi Nathan, thank you for this tutorial.
However, my "add" button doesnt work. am i missing a line of code?
What will be the ouput of this line 3+3+"7" in java script
I try this code with 5 variables but it dosent works:
function addnum()
{
var num1, num2, num3, num4, num5, sv1;
num1 = Number(document.form1.r1.value;)
num2 = Number(document.form1.r2.value;)
num3 = Number(document.form1.r3.value;)
num4 = Number(document.form1.r4.value;)
num5 = Number(document.form1.r5.value;)
sum = num1 + num2 + num3 + num4 + num5;
document.form1.sv.value = sum;
}
document.write("Thank you!");
please help?
it comes up with [object HTMLInputElement][object HTMLInputElement]
in my sum input box when i click add
the tutorial will tell you why. XD
same problem…probably u already have figured it out till nw..:)
How would you do it if you wanted to have 1 + 1 and then you write in the answer and it tells you if you did it wrong or right?