1 function tijiao(){ 2 var elem = document.getElementById("dish_sort"); 3 var index=elem.selectedIndex; 4 alert(elem.options[index].value); 5 alert(elem.options[index].id); 6 }
1 <td>菜品分类:</td><td><select name="dish_sort" id="dish_sort"> 2 <c:forEach var="a" items="${list}"> 3 <option id="${a.id}" value="${a.sort}">${a.sort}</option> 4 </c:forEach> 5 </select></td>