I need to get 2 variables from a select box when a selection is made. so I stored one variable as the name attribute and the other as the value attribute.
I am using a function to get these like this:
function blue_diamond_selected() {
var select_box = document.getElementById(“blue_diamond_select_box”);
var option_value = select_box[select_box.selectedIndex].value;
var option_name = select_box[select_box.selectedIndex].name;
alert(option_value+“:”+option_name);
}
this works in IE but in FF it is not getting the name just the value…the name comes up as undefined.
Can someone help me? or if I am going about this completely wrong how should I do it?
<div>
<select id="blue_diamond_select_box" name="blue_diamond_select_box" onchange="blue_diamond_selected()">
<option value="1-37222" title="14k WG">.24 Ct. 14k WG $210</option>
<option value="1-80584" title="14k WG">.27 Ct. 14k WG $315</option>
<option value="1-80720" title="14k WG">.29 Ct. 14k WG $330</option>
</select></div>
Theres actually several options I just showed a few for simplicity. the value is needed for the actual form processing. but when they change the selection I want to update a picture to either show a white gold ring or a yellow fold ring depending on the selection. thats why I have that in the title. its currently working the way I have it here: http://www.sussexjewelers.com/blue_diamond_solitaires.php?pid=1868