Click to See Complete Forum and Search --> : Closing popup window when another one is opened


cedric813
July 11th, 2007, 05:17 PM
Hi everyone. I have a webpage at:

http://www.digitaldisplaydirectories.com/ad_board/left_frame/hotels/hotels_p1.html

(Please note: The page will only work properly in IE)


I have an issue with popup ads. If you go to my webpage (using IE) and click one of the ads, a popup appears which you can then close by pressing the close button. If you click one ad, a popup appears, but if you click another ad, without closing the first popup, the popup for the second ad will appear on top of or beside the first popup. I would like to make it so that if a popup is open and someone trys to open another popup (by clicking another ad), the first popup will close before the second one opens.

I hope I have explained everything okay. Please help, this has been driving me crazy.

Thanks so much,

Cedric

PeejAvery
July 11th, 2007, 05:31 PM
In order to work with other windows, you must properly define them when opening, and then use that defined handle to call each individual window. You can see an example of that here (http://www.codeguru.com/forum/showthread.php?t=427395). That should get you started on how to handle the windows properly.

What about your website only works properly in IE? I'm not having much trouble with anything and I use Safari for Mac.

cedric813
July 11th, 2007, 05:33 PM
Thanks so much for the reply. I haven't tested in on Safari, but I know that the popups don't work in firfox...which is okay with me. Thanks again.

PeejAvery
July 11th, 2007, 05:43 PM
That is because Firefox has a popup blocker built in, as does Safari. You can turn those off per browser settings. But popup blockers only block certain instances of window.open(). They will allow them so long as they are tied with an onclick event.