javascript returning undefined on length -
09-29-2005
, 11:44 AM
I am wanting to deteremine which radio button is selected on a form and
am using:
//alert(document.CC.Ecom_Payment_Card_Type.length)
for (var i=0;i<document.CC.Ecom_Payment_Card_Type.length;i+ +) {
if (document.CC.Ecom_Payment_Card_Type[i].checked) {
var CardType =
document.CC.Ecom_Payment_Card_Type[i].value
}
}
This works fine if there are 2 or more radio buttons, but if there is
only one, it fails. The alert if I uncomment it says that the length is
undefined, when it should be 1. Anyone know what the problem is and how
I can get around it?
Marshall |