[Javascript] focus() not working in NN6
Peter-Paul Koch
gassinaumasis at hotmail.com
Wed Nov 7 10:33:53 CST 2001
>I'm trying to find some insight into why this code does
>not work in NN6. This code is the event handler for an
>href tag. When I click the link, the new window opens
>and the correct URL loads, but then the original window
>gets the focus almost immediately. If I comment out the
>newWindow.focus() line, the new window is displayed for
>a few seconds longer, but it still loses focus.
Exactly what code do you use in the A tag? My guess is that you click the
link, the new window starts up and afterwards the normal thing happens: the
link is followed, and leads to the same page because you set its href
property. This last action, I think, returns the focus to the old window
because it's the last in which something happens.
Solution: try returning false so that the original link isn't followed. This
should keep the focus on the popup.
ppk
>code:
>
>function intercept(idx,urlstring,newwindowname)
>{
>
>
>
>document.links[idx].target = "";
>document.links[idx].href=self.location +
>self.location.hash;
>
>
> newWindow = window.open
>(urlstring,"","height=400,width=400,scrollbars,resizable"
>);
> newWindow.name = newwindowname;
> newWindow.focus();
>
>
>
>}
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>http://www.LaTech.edu/mailman/listinfo/javascript
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
More information about the Javascript
mailing list