Welcome to WebmasterWorld Guest from 54.163.168.15

Forum Moderators: open

How to Pop a child window -- and close itself onblur?

javascript

   
10:46 pm on Jan 31, 2007 (gmt 0)

10+ Year Member



I've been having trouble getting this working ...

I've tried something like this but I'm having trouble with it in IE6

Here's the open window code.

<a onclick="window.open('/Portal/HelpPopup.aspx?section=UserHome','helpWindow','scrollbars=yes,width=775,height=525,resizable=yes');">

And here's the cloes window code.

<body ONBLUR="window.close();">

The problem is when I try to use the scrollbar of this child window, the window closes itself.

Any ideas?

Thanks,

Rich

7:39 pm on Feb 2, 2007 (gmt 0)

5+ Year Member



You just have got to love Internet Explorer don't you?

There is a workaround at [pro-thoughts.blogspot.com...]

That works if you have other items on the body that you want to play with, textboxes and text areas can also trigger this behavior. links as well. So either send their result to the parent or to a new blank window.

If the scrollbar is the only window element that you want to interact with then try this fix;

<script>window.onblur=window.close()</script>

In IE this will trigger a close event on any click that is not on the scrollbar or the window's chrome.

Al Anderson

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month