function ChkRadio(){
var strRadio = document.getElementById('<%= RadioButtonList1.ClientID %>'); ←改成自己的名字
var i ;
var selValue = 0 ;
for(i=0; i<strRadio.rows[0].cells.length; i++){
if(strRadio.rows[0].cells[i].childNodes[0].checked == true){
selValue += 1;
}
}
if(selValue == 0){
alert("錯誤!!")
return false;
}
}
PS. 要注意的是,這裡的RadioButtionList是用水平橫式的(Horizontal),如果用直式的(Vertical),table.rows[0].cells[i]要改為table.rows[i].cells[0]。
全站熱搜