posted 16 years ago
I want to be able to show the selected value and name of the selected value in the list/menu box, but I cannot figure it out. A sample code is below. I have clearly marked the code which I cannot figure out and need help in. Please give me some suggestions if you have some. Thanks.
----------------------------------------------------------------
<script type="text/javascript" >
function show_selection() {
var index= document.select.selectedIndex;
/********Problem Below**************/
var value = I want to get the selected value(1,2,3,4)
var name = I want to get the the selected name(First,Second,Third,Fourth)
/**********Problem Above****************/
document.write(index);
document.write(value);
document.write(name);
}
</script>
<select name="select" size="1" onclck="show_selection()">
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Third</option>
<option value="4">Fourth</option>
</select>
---------------------------------------------------------------
[ May 16, 2007: Message edited by: Fritz Largosa ]
[ May 16, 2007: Message edited by: Fritz Largosa ]
[ May 16, 2007: Message edited by: Fritz Largosa ]