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

Q968 When opening a popup window from a link how can I stop the main page being replaced with the word '[object]'?

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

Q968 When opening a popup window from a link how can I stop the main page being replaced with the word '[object]'?

The windows open method returns a value - the window handle (an object reference) of the new window. When something is returned to the HREF attribute the browser attempts to render it.

To stop this from occuring do something like:

<script language="JavaScript"><!--
var windowHandle = '';

function myOpen(url,name,attributes) {
    windowHandle = window.open(url,name,attributes);
}
//--></script>

<a href="javascript:myOpen('page.htm','windowName','height=100,width=100')">text link</a>

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.