View Full Version : Cool DHTML Tooltip II

04-15-2005, 12:58 AM
Hello, first time poster here! :D

I am wanting to use the Cool DHTML Tooltip II for a new project in PHP I am working on. However, there is an issue I have come acrossed, is there any way to get this to work in FireFox?

Nevermind, I fixed it. However, why does it ONLY work IF you place the script code below the <body> tag of the HTML? I had the script in a tooltip.js and it worked perfect in IE, Netscape and Opera! Can someone shed some light on this?


04-15-2005, 06:32 PM
[W]hy does it ONLY work IF you place the script code below the <body> tag of the HTML?It should only work if the script element is placed after the tool-tip container. That would have to be after the body start tag in any case, unless you have some very badly written HTML.

The other reason (though the first one is enough) is that the script tries to access either the body or html element, depending on whether your document induces Quirks mode or Standards mode. If the user agent hasn't parsed the body, it won't exist within the document tree, so it's impossible to obtain a reference to it. As a result, the script would fail with a "Object has no properties"-like error.


04-15-2005, 07:07 PM
Just to add to what Mike said - as we go forward in time, we will probably find more and more browsers demanding this sort of logic in page code layout.