HomeArticlesFAQsXREFGamesSoftwareInstantBooksBBSAboutFOLDOCRFCsFeedbackSearchSite-Map
logo

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

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

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>

©2011 Martin Webb