jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes Object does not support property error! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Object does not support property error!" Watch "Object does not support property error!" New topic
Author

Object does not support property error!

Natalie Ap
Ranch Hand

Joined: Jan 09, 2009
Posts: 49
Hi all,

I am trying to run the following piece of code, but I am getting a javascript error "Object does not support property error!" and I am unable to understand what the problem might be.

There is a form called "updateForm" which I am trying to submit when i get the error. When I comment lines (1), (2), (3), the error does not get thrown. Please help me!!

Please let me know if you need any other information besides this.

Thanks,





Fiona
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Well first problem is document.all is IE only.

You should be using document.formName.elementName or
You should be using document.forms["elementName"] or
You should be using document.forms[0].elementName or
document.getElementById("elementID")

Eric

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Eric Pascarello wrote:document.forms[0].elementName
This is not specific enough, I wouldn't use it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61314
    
  66

I agree. The [0] notation is rather old-fashioned and is fragile. Avoid it.

id values allows you to specifically target an item without ambiguity.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object does not support property error!