Can someone explain to me why I get this error when i have one radio button in the array with a length size of one and i = 0?

]document.radioForm.Radio[i] is undefined
Line 25

Here's the code

ln = document.radioForm.Radio.length
		if(isNaN(ln)){
			ln = 1
		}
		alert(ln)

		for(i=0; i<ln; i++){
			alert(i)
			if(document.radioForm.Radio[i].checked){
			      status = true;
			}
		}

Error occurs at document.radioForm.Radio[0].

Thanks

Maybe if(isNaN(ln)) condition is met, therfore ln = 1 when document.radioForm.Radio.length is say 'undefined'.

If so, then maybe you could take some other action when if(isNaN(ln)) is met?

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.