03-25-2011, 12:46 AM
|
#2 (permalink)
|
|
The Addict
Join Date: Aug 2008
Posts: 336
Thanks: 8
|
it seems that your best fit is using javascript listening to the SELECT onChange event. I don't know where you want the result to come up so I am going to put it in an input text for this example:
the html
html Code:
<select id="howmany"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select>
<select id="price_options"> <option value="5">5</option> <option value="10">10</option> <option value="15">15</option> </select>
<input type="text" id="calc_result" readonly />
the javascript
javascript Code:
document.getElementById("price_options").onchange=function(){ var qty_menu=document.getElementById("howmany"), result=document.getElementById("calc_result"), qty=Number(qty_menu.options[qty_menu.selectedIndex].value), price=Number(this.options[this.selectedIndex].value);
result.value = (price * qty) + ''; }
That is untested code, just came up with it. It just shows the gist of the behavior you wanted.
|
|
|
|