mercoledì, settembre 10, 2008

JavaScript: Get the Value of a Combo Box's Selected Item

I’m always having to look up how to use JavaScript to use the value of a combo box in HTML.

<script>
function comboCheck() {
var comboValue var selIndex = document.frmName.select1.selectedIndex;
comboValue = document.frmName.select1.options[selIndex].text;
alert(comboValue)
}
</script>
.
.
.
<form>
<select name="combo" id="Hotel" onChange="comboCheck();”
<option value="one">one</option>
<option value="two">two</option>
</form>