<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> </head> <body> <!--<a href="http://www.runoob.com/" target="_blank">访问菜鸟教程!</a>--> <!--<p>点击太阳或其他行星,注意变化:</p> <img src="http://www.runoob.com/images/sun.gif" width="145" height="126" alt="Planets" usemap="#planetmap"> <map name="planetmap"> <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm"> <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm"> <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm"> </map>--> <!--<p>Do not forget to buy <mark>milk</mark> today.</p>--> <!--<div id="container" style="500px"> <div id="header" style="background-color:#FFA500;"> <h1 style="margin-bottom:0;">主要的网页标题</h1></div> <div id="menu" style="background-color:#FFD700;height:200px;100px;float:left;"> <b>菜单</b><br> HTML<br> CSS<br> JavaScript</div> <div id="content" style="background-color:#EEEEEE;height:200px;400px;float:left;"> 内容在这里</div> <div id="footer" style="background-color:#FFA500;clear:both;text-align:center;"> 版权 © runoob.com</div> </div>--> <!--<div style=" 100%; height: 500px; background: gold;"> <div style=" 50%; height: 100% ; background: red; float: left;"></div> <div style=" 50%; height: 100% ; background: green; float: left;"></div> </div>--> <!--<form> <input type="radio" name="sex" value="male">Male<br> <input type="radio" name="sex" value="female">Female </form> <form> <input type="checkbox" name="vehicle" value="Bike">I have a bike<br> <input type="checkbox" name="vehicle" value="Car">I have a car </form> <form name="input" action="html_form_action.php" method="get"> Username: <input type="text" name="user"> <input type="submit" value="Submit"> </form> --> <select id="test"> <option value="volvo">Volvo654</option> <option value="saab">Saab787</option> <option value="mercedes">Mercedes787</option> <option value="audi">Audi7877</option> </select> <button id="btn"> 提交</button> </body> <script type="text/javascript" src="js/jquery.js" ></script> <script type="text/javascript" src="js/jquery.min.js" ></script> <script type="application/javascript"> $("button").on("click",function(){ // $('input:[name="allSel"]').val() var options=$("#test option:selected"); //获取选中的项 alert(options.val()); //拿到选中项的值 alert(options.text()); //拿到选中项的文本 alert("dfgdf"); }); </script> </html>