Click to See Complete Forum and Search --> : Passing Values using Select


WebSteve
01-13-2004, 02:56 PM
I am trying to pass a value to a function using the Select tag, but the function doesn't seen to be receiving it. For troubleshooting purposes, I broke the code down to it's simplist form by just having the functon send an alert box that shows the value, but instead, the alert box pops up with no value showing up. I've tried other things, but the value never seems to get to the function.

Here is the code:

<script language="JavaScript"> {
function DeliverIt(Steve)
alert (Steve);
}
</script>

<select name="Deliver" onChange="DeliverIt(document.TravelReq.DeliverIt.options[document.TravelReq.DeliverIt.options.selectedIndex].value);">
(I left out the <option>s part, but that part works fine)

What could I be doing wrong??

fredmv
01-13-2004, 03:11 PM
Welcome to the forums.<select onchange="alert(options[selectedIndex].value);">
<option value="foo">foo</option>
<option value="bar">bar</option>
</select>