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

Discussion in 'Javascript' started by Matt, May 27, 2004.

  1. Matt

    Matt Guest

    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.elements.length-1; i++)
    { var obj = InputForm.elements;
    document.write(obj.type); //runtime error: object doesn't support
    this property or method
    }
    }

    any ideas?? thanks!!
     
    Matt, May 27, 2004
    #1
    1. Advertising

  2. Matt

    Lee Guest

    Matt said:
    >
    >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.elements.length-1; i++)
    > { var obj = InputForm.elements;
    > document.write(obj.type); //runtime error: object doesn't support
    >this property or method
    > }
    >}


    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.elements.length; i++)
     
    Lee, May 27, 2004
    #2
    1. Advertising

  3. Matt

    G Roydor Guest

    voir typeOf

    http://msdn.microsoft.com/library/d...html/vbconDiscoveringClassObjectBelongsTo.asp

    Matt a écrit:
    > 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.elements.length-1; i++)
    > { var obj = InputForm.elements;
    > document.write(obj.type); //runtime error: object doesn't support
    > this property or method
    > }
    > }
    >
    > any ideas?? thanks!!
     
    G Roydor, May 27, 2004
    #3
  4. Matt

    Lee Guest

    Lee, May 27, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roman
    Replies:
    0
    Views:
    4,063
    Roman
    Jan 4, 2004
  2. mygoogleac
    Replies:
    0
    Views:
    196
    mygoogleac
    Oct 2, 2003
  3. news.onetel.net.uk
    Replies:
    3
    Views:
    238
    Michael Winter
    Aug 9, 2004
  4. SmittyBroham
    Replies:
    2
    Views:
    139
    SmittyBroham
    Jan 7, 2005
  5. Drew
    Replies:
    1
    Views:
    111
    Martin Honnen
    Nov 8, 2006
Loading...

Share This Page