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

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

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

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?'

©2018 Martin Webb