homepage Welcome to WebmasterWorld Guest from 54.167.173.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

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




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

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

 

Al_Anderson




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved