javascript中取得asp.net的DropDownList控件的值
页面中用的DropDownList控件时,需要用javascript客户端脚本进行验证时,
var ddl = document.getElementById("控件名");
取得选中的列的值
ddl.options[ddl.selectedIndex].text
取得选中值相对应的ID
ddl.options[ddl.selectedIndex].value
本文介绍如何使用JavaScript获取ASP.NET页面中DropDownList控件的选中值及其对应的ID。通过document.getElementById方法定位控件,并利用options和selectedIndex属性实现。
javascript中取得asp.net的DropDownList控件的值
页面中用的DropDownList控件时,需要用javascript客户端脚本进行验证时,
var ddl = document.getElementById("控件名");
取得选中的列的值
ddl.options[ddl.selectedIndex].text
取得选中值相对应的ID
ddl.options[ddl.selectedIndex].value

被折叠的 条评论
为什么被折叠?