fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <script> function getIndex(){ var x=document.getElementById("mySelect"); alert(x.selectedIndex); } </script> </head> <body> <form> 你喜欢的水果是: <select id="mySelect"> <option>苹果</option> <option>橙子</option> <option>菠萝</option> <option>香蕉</option> </select> <br><br> <input type="button" onclick="getIndex()" value="弹出选中项"> </form> </body> </html>
运行结果