Namespace clash in IE


In JavaScript, in Internet Explorer, you cannot declare a global variable that has the same name as the id of any element on the same web page.

If you try and then try to use any method on that object, you get a « object does not support method » error.

Why? Because, in Internet Explorer, the global variables and the DOM objects share a common namespace. So the global variable is hidden by the DOM object.

Share

, ,

Les commentaires sont fermés.