rodchar-
Here's an example using an HTML SELECT and an .net DropDownList control.
The JavaScript is the same for both. I'd recommend the onChange event,
not onClick, since onClick fires when the control itself is simply clicked
and onChange waits until you CHANGE the control (which, in this case, is
it's selected index value).
html:
<form id="form1" runat="server">
<div>
<select id="SelectList" onchange="javascript:test(this)">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
<option value="Option 4">Option 4</option>
<option value="Option 5">Option 5</option>
</select>
<asp
ropDownList runat="server" ID="SelectListControl" onchange="javascript:test(this)">
<asp:ListItem Value="Option 1" Text="Option 1" />
<asp:ListItem Value="Option 2" Text="Option 2" />
<asp:ListItem Value="Option 3" Text="Option 3" />
<asp:ListItem Value="Option 4" Text="Option 4" />
<asp:ListItem Value="Option 5" Text="Option 5" />
</asp
ropDownList>
<div id="output"></div>
</div>
</form>
JavaScript:
<script type="text/javascript">
function test(o)
{
var selectedValue = o.value;
var output = document.getElementById('output');
if (typeof output.textContent != 'undefined')
output.textContent = selectedValue.toString(); // Firefox
else
output.innerText = selectedValue.toString(); // IE
return true;
}
</script>
HTH.
-dl