• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Testing for js Objects

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to determine if you have hold of an HTMLFormElement?

3 of 4 different browsers return different objects for one call:
FireFox: HTMLFormElement
IExplorer: object
Safari: HTMLCollection
Opera: HTMLCollection

This doesn't work for all browsers. Fails in FireFox and IE.


Any ideas?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Different browsers will implement this differently. Why do you care? You're never going to get anything but a form implementation from document.forms (unless it's undefined which is easily tested for) so why the need for a check?
 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
Different browsers will implement this differently. Why do you care? You're never going to get anything but a form implementation from document.forms (unless it's undefined which is easily tested for) so why the need for a check?



For some reason I'm not receiving a form in the different browsers. As stated before some are sending a collection (i.e., collection->form->input elems), ie an object and firefox a form.

I was able to get it to work by checking for a known field within the form.


It seems kinda weird.

Wait a sec.... I have two forms with the same name....

:slapsforehead:
[ May 29, 2008: Message edited by: graham king ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic