views:

44

answers:

3

Hey guys,

while surfing through the web and through stackoverflow.com i found many posts in forums, etc. where this message occures in IE but not in the other browsers. the thing is, the resolutions vary widely and it's not clear for me what's the best way to avoid this problem.

So my question is, if anybody knows exactly, specificly what this message Object doesn't support this property or method

means, causes, says ,...

thanks for help. helle

+1  A: 

It means the object doesn't support the method you're trying to call.

function Foo() {

};

var something = new Foo();

something.fish(); // Error: because fish is not defined as a method.
Matt
Teach an object to fish...
jeffamaphone
@jeffamaphone: That would be the other solution ;)
Matt
+1  A: 

Quite often, the real problem indicated by that error is that something your code expects not to be null is in fact null.

var thing = document.getElementById('thing');
var x = thing.getAttribute('x');

If there's no "thing" element in the page, the variable will be null and you'll get the error.

In general it's a good idea not to think too hard about what IE is trying to tell you with its error messages. Just imagine that the browser is making a dull grunting sound, like a badly-trained animal.

Pointy
A: 

well, after an other huge lookup for the causes of the problem (like in the microsoft JS specification ... where no complete table of errors can be found) i come to the same result like @Pointy. for sure @Matt has helped too! IE really grunts around, when something does not work for him. i didn't find any exact spezification of the error so far.

and there is the othere resume: in many many cases its caused by naming JS Object with same name like DOM-Elements or DOM-Elements IDs, because IE - in some cases - interpretes them as beeing the same. so you kind of overwrite objects from above. to avoid this, allways use the var [vaiablename] = [value]; syntax to initilize a variable. (the var is absolutly neccessary in IE. while surfing through forums , i found out it helps in very many cases but is no universel remedy.

regards helle

helle