form.elements[x] has no properties

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jeep@13.usenet.us.com

    form.elements[x] has no properties

    I get this in the following javascript:

    Error: form.elements[x] has no properites

    For the following function:

    function check_elems(for m,q,st,end) {
    var flag = false;
    if (end < st) { alert("check_el ems(): 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


  • Lasse Reichstein Nielsen

    #2
    Re: form.elements[x] has no properties

    jeep@13.usenet. us.com writes:
    [color=blue]
    > I get this in the following javascript:
    >
    > Error: form.elements[x] has no properites[/color]

    So x is probably too large.
    [color=blue]
    > function check_elems(for m,q,st,end) {
    > var flag = false;[/color]

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

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • jeep@13.usenet.us.com

      #3
      Re: form.elements[x] has no properties

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

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

      Thank you!
      Jeff

      Comment

      Working...