Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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?

irt.org | Knowledge Base | JavaScript | Window | Q345 [ previous next ]

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?

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.