Hi! How can a function be written so that it is reusable within the same form? eg, if I wish to place another select menu and result in the following code (eg.mySelect2, mySpan2) so that whichever select menu is chosen displays its own result:
Thanks!
TheMuffin
Code:
<html>
<head>
<script type="text/javascript">
function updateForm(doit)
{
selected = doit.mySelect.selectedIndex;
values = doit.mySelect.options[selected].value;
document.getElementById("mySpan").innerText = values;
}
</script>
</head>
<body>
<form name="myForm" id="myForm">
<p>
<tr><td name="48">
<select name="mySelect" id="mySelect" onChange="updateForm(this.form)">
<option value="1.99">1
<option value="3.59">2
<option value="5.29">3
<option value="6.99">4
</select>
$<span name="mySpan" id="mySpan">1.99</span
</td></tr>
</form>
</body>
</html>
Thanks!
TheMuffin