Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

Adding values from text boxes after onchange event
(1 viewing) (1) Guest
All your queries regarding JavaScript will be solved in this forum
  • Page:
  • 1
TOPIC:

Adding values from text boxes after onchange event

Adding values from text boxes after onchange event 1 year, 7 months ago #275

  • avan12
  • OFFLINE
  • Junior Boarder
  • Posts: 35
  • Karma: 0
Hi,

I need some assistance with this:

I have several text boxes that stores an integer, and after each value is placed, i'd like to place the total into a separate text box.

How can I achieve this ? Can any one help ?

Thanks in advance.

Re:Adding values from text boxes after onchange event 1 year, 7 months ago #278

  • sandhya
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Karma: 0
Hi,


<html>
<head>
<s-cript type='text/j-avascript'>
function sumValues() {
var v1 = parseFloat(document.getElementById('box1').value);
var v2 = parseFloat(document.getElementById('box2').value);
document.getElementById('box3').value = v1 + v2;
}
</script>
</head>
<body>
<form on-change=sumValues()>
<input id='box1' type='text' />
<input id='box2' type='text' />
<input id='box3' type='text' />
</form>
</body>
</html>
  • Page:
  • 1
Time to create page: 1.58 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download