var radioLength = document.forms[0].cardSelection.length;
var checked = false;
if (radioLength>0)
{
//if radio button more then 1
for(var i = 0; i < radioLength; i++)
{ if(document.forms[0].cardSelection[i].checked)
{ checked = true; break; }
}
}else
{ //if only have 1 radio button
if (document.forms[0].cardSelection.checked==true)
{ checked = true; }
}
No comments:
Post a Comment