Jump to content


JavaScript or PHP Help ...


2 replies to this topic

#1 trauma

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 18 August 2006 - 02:11 PM

I have a form that a customer enters a price in to one box and then they enter it in to another. I need these to add up and present themselves in another box within the same form. Is this possible, and if there is, is there a tutorial anywhere out there that could do this?

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 18 August 2006 - 04:31 PM

Ya, a quick search on the form section of this site should bring you to what you need. I'm not quite sure which one would help you best, and I'm sure you'd be able to find something even better than I would for your situtation. ^_^

#3 Hit3k

    Young Padawan

  • Members
  • Pip
  • 120 posts
  • Gender:Male
  • Location:Australia

Posted 18 August 2006 - 09:51 PM

you'd have something like
<script type="text/javascript">
function addup() {
	var price1 = (document.getElementById('price1').value * 1);
	var price2 = (document.getElementById('price2').value * 1);
	var total = price1 + price2;
	document.getElementById('total').value = total;
}
</script>
<form action="" method="POST">
<input type="text" id="price1" name="price1" onchange="addup();" />
<input type="text" id="price2" name="price2" onchange="addup();" />
<input type="text" id="total" name="total" />






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users