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

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

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

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

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


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.