stublackett Posted September 18, 2009 Share Posted September 18, 2009 Hi Guys, I've got a purchase system setup on my website... Theres a box titled "quantity" all I want to do is update the total as per the quantity amount.. We charge £45 for the product, So if 1 was entered, Obviously the script would need to do X * 45. Never really touched JavaScript before, so any help / pointers would be appreciated. Example form is @ : http://www.stuartblackett.com/order.php All I want it to do is work out the "Quantity" in the box, Then * 45.. I can do the PHP stuff to calculate the rest, Its just the Java I need.. Possibly AJAX, I dunno hopefully you guys can tell me Quote Link to comment Share on other sites More sharing options...
stublackett Posted September 18, 2009 Author Share Posted September 18, 2009 Just an update... I've found a script somewhere, Tried playing about with it. Hopefully along the right lines....... <html> <head> <script type="text/javascript"> function UpdateQuantity() { this.form.total.value = this.form.quantity * 45; } document.onkeydown=UpdateQuantity; </script> </head> <body> <form name="form" method="post" > Quantity:<br /> <input name="quantity" onfocus="UpdateQuantity();" onkeydown="UpdateQuantity();" type="text" /> <br /> Cost: <input name="total" type="text" value="0" size="5" /> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.