Board index » javascript » Newbie... Simple Window close() question
|
Micky McQuade
Registered User |
|
Micky McQuade
Registered User |
Newbie... Simple Window close() question
2005-01-09 09:56:28 AM
Just thinking off the top of my head, why don't you call a function in your parent window that does those three things. window.opener.doAllThree(self) and then in your parent function doAllThree(objWindow) { objWindow.close(); self.focus(); document.location.href = 'whatever.htm'; } This is definitely just thinking. I'm not even sure that you can pass the reference to the window object like that or not....hopefully it will get you closer though. Micky - |
| Richard
Registered User |
2005-01-09 02:26:00 PM
Re:Newbie... Simple Window close() question
"DixieGal" <hhd@ospammers-honeyhousedesigns.com>wrote in message
QuoteI know enough javascript to be dangerous <wink> You can try adding your window.close() to it and see if this works for you or not. It was designed to bring the popup to the front if the visitor did not close the window and went back to the originating page. <SCRIPT TYPE="text/javascript"> <!-- function popup(mylink, windowname) { if (! window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; window.open(href, windowname, 'width=600,height=100,left=100,top=200,resizable=yes,scrollbars=yes'); return false; } //--> </SCRIPT> <A HREF="popupbasic.html" onClick="return popup(this, 'notes')">my popup</A> - |
| Richard Cornford
Registered User |
2005-01-10 10:14:00 AM
Re:Newbie... Simple Window close() question
Richard wrote:
QuoteDixieGal wrote: QuoteNow I want my "close window" button to QuoteThis script uses window.focus, Quotewhich ensures that the popup will be not do anything if it is never called. QuoteYou can try adding your window.close() to it and QuoteIt was designed to bring the popup to the front proposed design intention. Quote<SCRIPT TYPE="text/javascript"> Quotefunction popup(mylink, windowname) test actually employs that method. Otherwise the implication is that this is a test by which the environment's support for other features is being inferred from the existence of an unrelated method. Testing of that type is utterly unreliable. Additionally, source code posted to Usenet should always be formally indented (as described in the FAQ). Quotevar href; general in its employment, in reality the result is to promote a disregard for variable type that is dangerous in a loosely typed language. The HTML employing this function will only ever pass an object reference to this function so this branching is not needed, and neither is the local variable - href -. Quotewindow.open(href, windowname, test on the wiindow.focus method logically should have been a test on the widnow.open method, as that is the environment feature that is actually used by the code. Quote'width=600,height=100,left=100,top=200,resizable=yes,scrollbars=yes'); relationship to the existing browser window. Quotereturn false; determined whether the window opening attempt has been successful. in the event that the window opening attempt failed (or that the new window will subsequently be closed by an external pop-up blocker) then this code should return true so that the browser can fall-back to the HTML link. Quote} keep it to yourself. Richard. - |
