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

Q1725 How do I avoid the main window displaying [object] when I click on a hypertext link to open a new popup window?

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

Q1725 How do I avoid the main window displaying [object] when I click on a hypertext link to open a new popup window?

Instead of using the window object's open() method in the href attribute, use the onClick event handler instead. If you return false from the onClick event handler then the default action of the click event (i.e. load the url specified by the href attribute) is cancelled:

<a href="default.htm" onClick="window.open('popup.htm','windowName','width=200,height=200');return false;">click</a>

Feedback on 'Q1725 How do I avoid the main window displaying [object] when I click on a hypertext link to open a new popup 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.