您的位置:首页 > Web前端 > JavaScript

用JS获取DropDownList选中得值

2016-06-20 10:43 585 查看
HTML:

<asp:DropDownList ID="DropdownList1" runat="server" AutoPostBack="true" />


JS:

<script type="text/JavaScript">
function getvalue(){

var select1 = document.all.<%= DropdownList1.ClientID %>;
var selectvalue = select1.options[select1.selectedIndex].value;
var selectText= select1.options[select1.selectedIndex].text;
alert(selectvalue+"  "+selectText);
}
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: