form.elements[x] has no properties

J

jeep

I get this in the following javascript:

Error: form.elements[x] has no properites

For the following function:

function check_elems(form,q,st,end) {
var flag = false;
if (end < st) { alert("check_elems(): invalid st "+st+" and end "+end); }
for (var x = st; x <= end; x++) {
//alert(x);
if (form.elements[x].checked) {
flag = true;
}
}
if (!flag) {
// alert("Please answer question " + q +
// " and any others you may have forgotten.");
}
return flag;
}

After hours of trying to find the answer, I give up!

Any help is appreciated,
Jeff
 
L

Lasse Reichstein Nielsen

I get this in the following javascript:

Error: form.elements[x] has no properites

So x is probably too large.
function check_elems(form,q,st,end) {
var flag = false;

Add:
if (end >= form.elements.length) { alert ("this is not happening!");}
and see if it is happening.

/L
 
J

jeep

Error: form.elements[x] has no properites
So x is probably too large.
Add:
if (end >= form.elements.length) { alert ("this is not happening!");}
and see if it is happening.

Oh DUH! You are right. I split up a very long page and never changed
the element numbers!

Thank you!
Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top