[thelist] IE JavaScript issues?

Lee kowalkowski lee.kowalkowski at googlemail.com
Mon Nov 20 10:11:13 CST 2006


On 20/11/06, Thomas Nilsson <thomas.nilsson at framfab.com> wrote:
> >       hint = document.getElementById("hint");
>
> In Internet Explorer, "hint" is itself a reference to the element,
> another (older and IE only) way of accessing elements.
>
> It's easily fixed by using another variable name, e.g.
>
>        elmHint = document.getElementById("hint");

Well spotted!  Perhaps better to just restrict the scope of the
variable in the first place:

var hint = document.getElementById("hint"); // works a treat.

Although it's sometimes preferable to use a naming convention like
hintElement, hintDiv or whatever in more complicated scripts.

-- 
Lee



More information about the thelist mailing list