If you don’t use any javascript framework such as jquery.js or prototype.js the combo object isn’t so easy to use, because when you try to get the selected value or the selected option string you can’t do it simply with obj.value as you do for a input type text box.
You can add this two function to the object:
HTMLSelectElement.prototype.getValue = function () { return this.options[ this.options.selectedIndex ].value ; } HTMLSelectElement.prototype.getText = function () { return this.options[ this.options.selectedIndex ].innerHTML ; }
So you can reach the value and the option string simply this way:
var SelectedValue = document.form.comboname.getValue(); var SelectedOptionString = document.form.comboname.getText();