View Full Version : Adding numbers linked to data

06-25-2004, 09:06 AM
My code so far is as follows:

<script type="text/javascript">
function put()

Select your power supply:
<select name="myList" onclick="put()">
<option>450 watt power +$0.00</option>
<option>550 watt power +$15.00</option>
<option>650 watt power +$50.00</option>
<br /><br />
Your selection is: <input type="text" name="favorite" size="20">


I want to link numbers to each option then display the number linked to the option instead of the whole option. This script is working. And I hope to be able to add many options to get a final value. Thanks for any help available.

06-25-2004, 09:33 AM
function put(objSel)
<select name="myList" onclick="put(this)">
<option value="">Choose one</option>
<option value="450">450 watt power +$0.00</option>
<option value="550">550 watt power +$15.00</option>
<option value="650">650 watt power +$50.00</option>

See how the function can be shortened and be made flexible by using function parameters.