By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,717 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,717 IT Pros & Developers. It's quick & easy.

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

P: n/a
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[i];
document.write(obj.type); //runtime error: object doesn't support
this property or method
}
}

any ideas?? thanks!!
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Lee
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[i];
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++)

Jul 23 '05 #2

P: n/a
voir typeOf

http://msdn.microsoft.com/library/de...tBelongsTo.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[i];
document.write(obj.type); //runtime error: object doesn't support
this property or method
}
}

any ideas?? thanks!!


Jul 23 '05 #3

P: n/a
Lee
G Roydor said:

voir typeOf

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


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

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.