15,664,823 members
1.00/5 (1 vote)
See more:
Hi Everyone
I want to add add two number that are in two textbox and transfer its value in third textbox using javascript. i am implement this code but addition of thes two number not automatic display in third textbox. please can you tell me where am i worg. can you wright code.
XML
<script type="text/javascript">
//<![CDATA[
var total = (parseInt(\$('#<%= txtmaxmarks.ClientID %>').val()) + parseInt(\$('#<%= txtmarks.ClientID %>').val())) * parseInt(\$('#<%= txtper.ClientID %>').val()); ct100_BodyContent_txtTotalOrder.initialvalue = total;
//]]>
</script>

i am using this code
Posted
Updated 23-Dec-16 5:28am

## Solution 1

<html>
<title>Input tutorial</title>
<script language="javascript">
{
var val1 = parseInt(document.getElementById("value1").value);
var val2 = parseInt(document.getElementById("value2").value);
ansD.value = val1 + val2;
}
</script>
<body>
value1 = <input type="text" id="value1" name="value1" value="1"/>
value2 = <input type="text" id="value2" name="value2" value="2"/>
</body>
</html>

Thanks

Amir Mahfoozi 7-Jan-12 5:46am
+5
Sridhar Patnayak 7-Jan-12 5:47am
Thanks Amir
Sergey Alexandrovich Kryukov 7-Jan-12 6:00am
All right, a 5.
--SA
Sridhar Patnayak 7-Jan-12 6:05am
Thanks SAKryukov
Member 8445148 7-Mar-14 6:29am
thank u for ur support

# JavaScript Operators

x = 5, y = 2, calculate z = x + y, and display z:

var x = 5;
var y = 2;
var z = x + y;
document.getElementById("demo").innerHTML = z;

Richard MacCutchan 23-Dec-16 13:01pm
Why are you posting here? This question is nearly 5 years old.

## Solution 4

function hi(){
var x=document.getElementById("f").value;
var y=document.getElementById("ff").value;
var z=x+y;
alert("z = "+z);// here i getting the answer 56 if the value of x=5 and y=6
document.getElementById("fff").innerHTML=z;

}