This is a discussion on "Automatic calculations" within the JavaScript Forum section. This forum, and the thread "Automatic calculations are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Automatic calculations
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Automatic calculations
Hi,
I'm working with a form at the moment in which someone requests a product, and it autmatically give a calculation when they click an option. Thorough explanation: This is a DVD creation business, for personal occasions, business conferenece slideshows, school presentations etc. For each picture they wish to use will cost them, lets say, 15p, they access the dropdown menu and tick that they want, say 30 pictures, once they select this, the calculation will automatically update and show the total price. (15p*30p = £4.50 obviously) However, because i am new to javascript i have ran into a problem. I have added a code in which this happens but dont know how to add another value without resulting in te first messing up. HTML:
regard, joe. |
|
|
|
|||
|
Re: Automatic calculations
Don't make your price field hidden. Just make it read only so the user cannot alter it and get rid of the onblur() function.
Quote:
Why not let the user just type in a quanity rather than have a huge long selection? |
|
|||
|
Re: Automatic calculations
Quote:
Unless you think there is an easier way? Thanks. |
|
|||
|
Re: Automatic calculations
You didn't answer my query about 'messing up', or has the first bit of my response fixed everything?
|
|
|||
|
Re: Automatic calculations
Oh, apologies.
What i mean by 'messing up' is: Although the code provided does work in terms of calculating the value, when i try to add another dropdown box, i believed that adding the simple code to both: javascript:
Last edited by josephman1988; Dec 22nd, 2006 at 15:57. |
|
|||
|
Re: Automatic calculations
Include a parameter in your function call so that the function can determine which dropdown initiated it and act accordingly.
|
|
|||
|
Re: Automatic calculations
How would I do this, sorry for being a troublesome newbie but we have to start somewhere. Thanks again.
|
|
||||
|
Re: Automatic calculations
function sample(parameter){ // taking in the parameter
var a = parameter + 9; } sample(1); // sending the parameter // the example above will store the value 10 in variable 'a'
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
![]() |
| Tags |
| auto, calculations |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automatic Scheduling | Jackus | PHP Forum | 4 | Apr 5th, 2008 01:59 |
| Automatic Backups | Gee Bee | Databases | 9 | Jan 22nd, 2006 02:48 |
| Automatic Sending | accessman | Databases | 0 | Sep 25th, 2005 17:25 |
| Automatic Automated mail out | briandmenupalace | Classic ASP | 4 | Jul 14th, 2005 17:58 |
| automatic redirects | benbacardi | Classic ASP | 2 | Sep 13th, 2004 09:02 |