Click here to Skip to main content
15,887,854 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
hai to all

i am using 15text box in a form

and total value must be declared in another textbox(text box16)

if i entered the value in first textbox and the value in second textbox

the total value will be displayed on the total textbox using textchanged event

i want to do in javascript

any idea plz



Thanking in advance
Posted
Comments
Sergey Alexandrovich Kryukov 28-Apr-11 1:51am    
There can be only one idea: write it. It's only a few lines. If you face a problem, report it and ask how to resolve it. This is how CodeProject really work.
--SA

You can handle the onkeypress event of the textbox. Here[^] is a background on this event.

This[^] is a code sample that demonstrates how to do it.
 
Share this answer
 
u can take html textbox for result and use onclick() event like

C++
<input type="text" id="resulttxtbox" name="resulttxtbox" onclick="return sumall()" runat="server" />


and call javascript function to add

XML
<script type="text/javascript">
   function sumall()
   {
   var a=document.getElementById("TextBox1");
   var b=document.getElementById("TextBox2");
   var c= parseInt(a.value)+parseInt(b.value);
   var d=document.getElementById("resulttxtbox");
   d.value=c;
   return false;
   }
   </script>
 
Share this answer
 
Comments
Member 9579525 15-Feb-13 0:56am    
I am doing same to calculate total amount but its not working..
Thanks for the Q and here is the answer for it

XML
<input type="text" onpropertychange ="MoniterChange()" id="Demo"/>
    <input type="text" id="Count" />


XML
<script>
       function MoniterChange() {
           document.getElementById('Count').value = document.getElementById('Demo').value.length;
       }
   </script>
 
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