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

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

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

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

©2013 Martin Webb