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

  • Follow


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!!
0
Reply jrefactors 5/27/2004 3:49:24 AM

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++)

0
Reply Lee 5/27/2004 4:11:22 AM


voir typeOf

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/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[i];
> 		document.write(obj.type); //runtime error: object doesn't support
> this property or method
> 	}
> }
> 
> any ideas?? thanks!!

0
Reply G 5/27/2004 1:54:46 PM

G Roydor said:
>
>voir typeOf
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vbconDiscoveringClassObjectBelongsTo.asp

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

0
Reply Lee 5/27/2004 3:04:23 PM

3 Replies
544 Views

(page loaded in 0.069 seconds)

Similiar Articles:













7/22/2012 3:32:13 PM


Reply: