Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q345 How can I make a generic function that opens up windows using the url, window name that I pass, which correctly defines the opener as the current window?

You are here: irt.org | FAQ | JavaScript | Window | Q345 [ previous next ]

Try this:

<SCRIPT LANGUAGE="JavaScript"><!--
function myopen(url,name,parms) {
    var handle = window.open(url,name,parms);
    if (!handle.opener) handle.opener = self;
    return handle;
}

var window1 = window.myopen('http://www.irt.org/','windowName1','width=400,height=400');
var window2 = window.myopen('http://www.netscape.com/','windowName2','width=400,height=400');
var window3 = window.myopen('http://www.microsoft.com/','windowName3','width=400,height=400');
//--></SCRIPT>

©2018 Martin Webb