function isSelected(value) { var cityName; var city = document.getElementById("city"); //获取选中的城市名称 for(i=0;iif(city[i].selected==true){ cityName = city[i].innerText; //关键点 alert("cityName:" + cityName); } }
也可以这么做:
代码如下:
function isSelected(value) { var city = document.getElementById("city"); alert(city.options[city.selectedIndex].innerText); }