|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
what am I doing wrong?
What is wrong with the code below?
I am trying to addup the number value from two dropdown boxes one called slots one called locations. However the below code just puts both $values in my price box not the total of the two?? <script language="JavaScript" type="text/JavaScript"> function MyChange(CalcPrice){ document.Form1.price.value = document.Form1.slots.value + document.Form1.locations.value; MyCalc(); } </script> |
|
#2
|
||||
|
||||
|
RE: what am I doing wrong?
try eval()
|
|
#3
|
|||
|
|||
|
RE: what am I doing wrong?
ok I am still lost. I tried to look for some tutorials with no luck so maybe can someone show me the doe I would use or explain in further detail how I would add the number values of 2 or more form fields together into a third text box called total ??
Basiclly if I have two dropdown boxes that call various prices from a mysql dbase so dropdown box one has as choices: 1.00 2.00 3.00 and dropdown 2 has 5.00 6.00 7.00 (those are the prices pulled from the dbase) How do I add the selected $price from each dropdown and display the total price in a textbox named total ?? Thanks all |
|
#4
|
||||
|
||||
|
RE: what am I doing wrong?
what part of look up eval() are you not getting?
this forum is about us trying to help you learn to do it yourself. You need to do two things, one you need to have a trigger, in this case I recomend the onChange event handler so that when you change your list boxes the total is recalculated. the eval() method will add the two numbers together, so instead of saying "I don't get it and skpping past the fact I gave you the method you need" why don't you try and play with it and then let us know what you got. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > what am I doing wrong? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|