JS中:
1 <body> 2 <select name="PaymentType" style="110px" > 3 <option value="">请选择 </option> 4 <option value="001">月付</option> 5 <option value="002">半年付</option> 6 <option value="003">年付</option> 7 </select> 8 <script language="javascript"> 9 function Gettext(obj){ 10 var txt=obj.options[obj.options.selectedIndex].text; 11 alert(txt) 12 } 13 function Getvaule(obj){ 14 var val=obj.options[obj.options.selectedIndex].value; 15 alert(val) 16 } 17 </script> 18 </body>
jQuery中:
<body> <select name="PaymentType" style="110px" > <option value="">请选择 </option> <option value="001">月付</option> <option value="002">半年付</option> <option value="003">年付</option> </select> <script language="javascript"> function Gettext(obj){ var txt=$(obj).find("option:selected").text(); alert(txt) } function Getvaule(obj){ var val=$(obj).find("option:selected").val(); alert(val) } </script> </body>