I’m very glad to have just discovered that one “misterious” problem that I was facing some time ago in one javascript program of mine, was due to this rule:

A common shortcut (introduced by IE and reproduced in some other browsers) in accessing DOM elements that have ID attributes is to use a provided global variable with the same name as the element’s ID string.

What it means is that you’re using a <p id="elisir"></p>, IE and friends will create a global “elisir” javascript variable for you. Watch out, and always use var to explicity declare your variable.

This hint was copied from jibberjim javascript FAQ.

Print