类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
在前台页面中如何用Jscript获取页面中WEB服务器控件RadioList,CheckBoxList,DropDownList被选取的的值?在线等……
刚才通过document.all.TextBox.value获取了TextBox的值。
可是在遇到上面三个控件时,获取不了。
网友回答:
DropDownList 在前台是<select>也是用 document.all("DropDownList1").value 可以获得的.
CheckBoxList和RadioList就麻烦多了.
你要通过
var coll=document.getElementByNames("RaidoList1");
来获得一个集合.
然后
for(var i=0;i<coll.length;i++)
{
}
来循环这个集合
用
var item=coll.item(i);
来获得某一项
item.value就是该项的值,而item.checked就是是否被选中。