Javascript: Adding Two Variables




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”

  1. 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; 
    }

Leave a Reply