Hello,
Need help. I'm writing javascript function to walk down a entire form, and I'm checking various element types to make sure the fields are filled in. But when I get to radio buttons, I'm having problems figuring out how many elements correspond to that radio button. For example,
str = myform.elements
for ( i = 0; i < str.length; i++ ) {
if ( str.type == 'radio' ) {
alert 'length = ' + str.name.length).
}
}
Well, the alert is printing out 11 for the length (where it should be 2). I'm guessing it's taking how many characters str.name has, which is what I don't want. Is this some sort of evaluation problem ??? Are there any ways around this ??
Thank you !!
Need help. I'm writing javascript function to walk down a entire form, and I'm checking various element types to make sure the fields are filled in. But when I get to radio buttons, I'm having problems figuring out how many elements correspond to that radio button. For example,
str = myform.elements
for ( i = 0; i < str.length; i++ ) {
if ( str.type == 'radio' ) {
alert 'length = ' + str.name.length).
}
}
Well, the alert is printing out 11 for the length (where it should be 2). I'm guessing it's taking how many characters str.name has, which is what I don't want. Is this some sort of evaluation problem ??? Are there any ways around this ??
Thank you !!