runtime error: object doesn't support this property or method

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

    #1

    runtime error: object doesn't support this property or method

    I tried to display all html control types in the form. But it has run
    time error
    "object doesn't support this property or method" on
    document.write( obj.type);

    Even I do document.write( 'hello world'); it still has the same error.
    function clearForm()
    { var i=0;
    for (i=0; i<InputForm.ele ments.length-1; i++)
    { var obj = InputForm.eleme nts[i];
    document.write( obj.type); //runtime error: object doesn't support
    this property or method
    }
    }

    any ideas?? thanks!!
  • Lee

    #2
    Re: runtime error: object doesn't support this property or method

    Matt said:[color=blue]
    >
    >I tried to display all html control types in the form. But it has run
    >time error
    >"object doesn't support this property or method" on
    >document.write (obj.type);
    >
    >Even I do document.write( 'hello world'); it still has the same error.
    >function clearForm()
    >{ var i=0;
    > for (i=0; i<InputForm.ele ments.length-1; i++)
    > { var obj = InputForm.eleme nts[i];
    > document.write( obj.type); //runtime error: object doesn't support
    >this property or method
    > }
    >}[/color]

    Don't use document.write( ) for debugging. As soon as you write
    anything to a document that has already been displayed, you
    clear the current contents. That means that on the second time
    through the loop, your form is gone.

    Use alert(), unless you have dozens of fields.

    Also, your loop is missing the last form element. That may be
    what you want if you know that the last element is your submit
    button. Otherwise, your loop should be:
    for(i=0; i<InputForm.ele ments.length; i++)

    Comment

    • G Roydor

      #3
      Re: runtime error: object doesn't support this property or method

      voir typeOf

      http://msdn.microsoft.com/library/de...tBelongsTo.asp

      Matt a écrit:[color=blue]
      > I tried to display all html control types in the form. But it has run
      > time error
      > "object doesn't support this property or method" on
      > document.write( obj.type);
      >
      > Even I do document.write( 'hello world'); it still has the same error.
      > function clearForm()
      > { var i=0;
      > for (i=0; i<InputForm.ele ments.length-1; i++)
      > { var obj = InputForm.eleme nts[i];
      > document.write( obj.type); //runtime error: object doesn't support
      > this property or method
      > }
      > }
      >
      > any ideas?? thanks!![/color]

      Comment

      • Lee

        #4
        Re: runtime error: object doesn't support this property or method

        G Roydor said:[color=blue]
        >
        >voir typeOf
        >
        >http://msdn.microsoft.com/library/de...tBelongsTo.asp[/color]

        No. He's trying to access the "type" field of form controls.

        Comment

        Working...