hi everyone,
i need to calculate the sum of all text boxes in to a single text box.
assume:
text box1=100, totaltextbox should be 100,
If i enter,
textbox1=250,textbox2=200.When i enter value to the textbox1,total should be 250.once i enter the second value to the textbox2,total should change to 450.it just like a onchange function.
this is not happening when i press submit button.it should happen automatically.When i leave the textbox1,total should display the value of text box1.then i enter textbox2,total should be the sum of textbox 1 & textbox 2.
Hope everyone got my point.
Please help me to solve this as soon as possible.
thanks in advance.......
calculate sum of all text boxes
Moderator: General Moderators
Re: calculate sum of all text boxes
Basic idea: you'll want to use JavaScript's document.getElementsByTagName('input') and iterate through results. If input.type == 'text', add input.value to the total.
Re: calculate sum of all text boxes
can you explain it more please?Because i have less knowledge in javascript
Thanks in advance
Thanks in advance
Re: calculate sum of all text boxes
A great place to learn JavaScript is the Mozilla Developer Network Docs. Here are the docs and examples for getElementsByTagName.