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

Q40 When I open a new window, how can I change the contents of the original window from the new window?

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

Q40 When I open a new window, how can I change the contents of the original window from the new window?

Within the original window:

<script language="JavaScript"><!--
function newWindow(file,window) {
    msgWindow=open(file,window,'resizable=no,width=200,height=200');
    if (msgWindow.opener == null) msgWindow.opener = self;
}
//--></script>

<form>
<input type="button" value="Open New Window" onClick="newWindow('a.html','window2')">
</form>

Within the new window:

<script language="JavaScript"><!--
function load(file,target) {
    if (target != '')
        target.window.location.href = file;
    else
        window.location.href = file;
}
//--></script>

<a href="javascript:load('b.html',top.opener)">load document into opener</a>
<p>
<a href="javascript:load('b.html','')">load document</a>

Feedback on 'Q40 When I open a new window, how can I change the contents of the original window from the new window?'


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.