[Javascript] window.open() not working in onLoad() of Mozilla 1.5

Paul Novitski paul at novitskisoftware.com
Tue May 4 13:50:56 CDT 2004


At 06:01 AM 5/4/2004, Mike Dougherty wrote:
>I've never used a real window.open(ing) popup, because this strategy keeps 
>the content in the document and allows direct references to the "parent" 
>document (because the 'popup' is actually part of the DOM tree)


Ah, but Mike, if you had ever worked with window.open() you'd know that the 
child window and its parent (and its siblings in the case of multiple 
pop-ups) are in full communication with one another through the DOM, as 
thoroughly as a div or any other tag within the parent window itself.

parent access to child:
         var oChild = window.open(sURL, sName, sArgs)
         oChild is the child window object
         e.g., oChild.document.location = "http://..."
         e.g., oChild.document.getElementById("DivInsideChild")

child access to parent:
         window.opener is the parent window object
         e.g., window.opener.document.location = "http://..."
         e.g., window.opener.document.getElementById("DivInsideParent")

In my own work, the main advantage of using a div for a pop-up is that I 
can build its chrome from scratch and don't have to worry about trying to 
suppress the O/S window chrome, while the main advantage of .open()ing a 
new window is that I can easily load it with the src of a new URL on the fly.

Question:  Is there a way to load a div with the html content of a separate 
URL after a page has been initially rendered?  I've been using iframes 
recently in IE6 but find them a bit awkward to control.

Paul


At 06:01 AM 5/4/2004, you wrote:
>How difficult would it be to populate a <div id='popscreen' 
>style='display: none; z-index:100; position:absolute; top:X; left:Y;'> 
>with the contents of your popup, then in some other object:
>onClick="document.getElementById('popscreen').style.display='inline'; "
>
>I've never used a real window.open(ing) popup, because this strategy keeps 
>the content in the document and allows direct references to the "parent" 
>document (because the 'popup' is actually part of the DOM tree)
>
>What do you [all] think of this plan?





More information about the Javascript mailing list