468,243 Members | 1,871 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,243 developers. It's quick & easy.

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.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
3 3238
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
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
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.

Similar topics

6 posts views Thread by Bill Patel | last post: by
7 posts views Thread by Martin Robins | last post: by
2 posts views Thread by serviceman via AccessMonster.com | last post: by
4 posts views Thread by Cylix | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.