Click here to Skip to main content
15,911,890 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, i have few text boxes contains int values and other text box(calculation) which should get the value by doing sum mathematical operation using if else on those few text boxes and present in this calculation text box..

whenever we change values in those text boxes the value should change by itself in calculation text box..

any one can help please
Posted

<script language="javascript" type="text/javascript">

       function functn() {
           var a = document.getElementById('text1').value;
           var b = document.getElementById('text2').value;
           if (a == "")
               a = 0;
           if (b == " ")
               b = 0;

           var res = parseInt(a) + parseInt(b);

document.getElementById('text3').value = res;
</script>

<input type="text" value="text1">
<input type="text" value="text2" onblur="functn()" >
<<input type="text" value="text3" ></input>
 
Share this answer
 
v3
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900