View Full Version : Modal problems and onload events

12-01-2006, 08:07 PM
Hey all,

I'm trying to add a modal dialog box on my web site and found a fairly easy - to -modify script (or so I thought) that does what I need in FF, but for some reason I get JS errors in IE.

Here's a link to my dev site:

If you open this page in FF you should get a modal pop-up. However, in IE, I get an error on line 109..

gPopupMask.style is null or not an object

It seems that IE is choking on that line. I've tried several approaches,b but nothing seems to work. Does anyone have any idea what I might be missing? I've tried changing things from body onload="somfunction()" to moving the onload event the header (window.onload = somefunction;) but neither method works.

If anyone could help, I'd be mighty appreciative. If anyone knows of another modal script that I can use that easily allows for onload calls, that would be good too.


12-01-2006, 10:03 PM
In FF I still get the error but it shows the modal box. So it is probably not a browser specific issue.


12-01-2006, 10:07 PM
Are you calling initPopUp() somewhere before you try to show one? At first glance I didn't see it.


12-01-2006, 10:26 PM
Without looking at the source, a quick thing comes to mind that you can't use the style object unless you're using inline styles. Otherwise, it's null.

Not sure if this is still true, maybe Kor can confirm?

12-01-2006, 11:04 PM
Hmm, I see it has

addEvent(window, "load", initPopUp);

I'm not sure how that works with

window.onload = function () {}

Which one would go first? Would one overwrite the other?

Questions I don't know the answer to. :) But I do think the problem is your modelbox is being called before initPopUp.