| re: popup window blur event
lazar wrote:[color=blue]
> I'm triing to write script that close popup window, when user click
> outside the popup.
>
> Script below is working fine in firefox (v1.0.3), but not in IE.
>
> I tried also to print hello but still the same problem firefox OK IE
> not.
> I think the problem is in event capture, but I can't fix it.[/color]
the popup has to set its own onblur
(sometimes it does work also with IE)
Do not remenber if onblur must be in a js script (in head)
or simply in body tag ?
(one of both won't work)
[color=blue]
>
> My script:
> fotowin = window.open("", "foto", "width =100,height
> =100,location=no,menubar=no,directories=no,toolbar =no,scrollbars=no,resizable=no,status=no");
>
> fotowin.onblur = closeWin;[/color]
I do not think that is possible
on my idea : fotowin.onblur
means you give to the popup a function (or event) 'onblur'
doesn't mean main window looks for 'does fotowin loose the focus?'
or at least doing :
fotowin.onblur = Function ('self.close();');
You can't attach to the onblur of popup the function closeWin()
belonging to the opener ...
except this way (not tested) :
fotowin.onblur = opener.closeWin;
but you can do its inverse
if main window (the opener) gets back focus hop! close popup
<body onfocus="if(!(fotowin) || fotowin.closed) '';
else fotowin.close();">
[color=blue]
> if (fotowin.captureEvents) {
> fotowin.captureEvents(Event.BLUR);
> }
>
> function closeWin() {
> fotowin.close();
> //fotowin.document.write("hello");
> }[/color]
--
Stephane Moriaux et son [moins] vieux Mac |