Return the selected option as a number
<html> <head> <script type="text/javascript"> function getIndex(){ var x=document.getElementById("aSelectControl") alert(x.selectedIndex) } </script> </head> <body> <form> Select your favorite language: <select id="aSelectControl"> <option>Java</option> <option>Perl</option> <option>PHP</option> </select> <br><br> <input type="button" onclick="getIndex()" value="Show index of selected language"> </form> </body> </html>