2008年12月18日 星期四

ASP.NET在javascript中取得CheckBoxList 以及DropDownList

CheckBoxList

//檢查XXXX是否選擇
var acclist = document.getElementById("<%=XXX_CheckBoxList.ClientID%>");
for (i = 0; i < acclist.all.tags('input').length; i++) {
if (acclist.all.tags('input')[i].type == 'checkbox') {
accbx = acclist.all.tags('input')[i];
if (accbx.checked) {
...........
}
}
}



DropDownLilst

var o= document.getElementById("<%=XXX_DropDownlist.ClientID%>");
var ovalue=o.options[o.selectedIndex].value

沒有留言: