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

Q577 If I open a window and I give it a name, can I perform operations based on the name?

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

No. You have to use the window handle:

<form>
<input type="button" onClick="windowHandle = window.open('test.htm','windowName')" value="Open">
<input type="button" onClick="window['windowHandle'].close()" value="Close">
</form>

Or:

<form>
<input type="button" onClick="windowHandle = window.open('test.htm','windowName')" value="Open">
<input type="button" onClick="windowHandle.close()" value="Close">
</FORM>

See also the answer to FAQ#782 Is it possible to get access to a named window, opened with target=name?

Feedback on 'Q577 If I open a window and I give it a name, can I perform operations based on the name?'

©2018 Martin Webb