views:

18

answers:

1

I have a popup function in a program that works well, be re-loads the parent page as it loads the child. Is there a way to prevent this behaviour.

// popup window function
function newPop(url, myWin, width, height, left, top, scrollbars) {
    parms = 'toolbar=yes, scrollbars=no, location=no,  menubar=no, resizable=no, width= ' + width  + ' , height=' + height + ' , left= ' + left   + ' , top= ' + top  + ' , titlebar=no , scrollbars = ' +  scrollbars ;    
    var newwin = window.open(url,myWin, parms); 
    newwin.resizeTo(width,height);  
    newwin.moveTo(0,0);
    newwin.moveTo(left,top);
    newwin.focus();
    return false;
}
+1  A: 

My guess is that you do not cancel the default behavior of the link that triggers the popup:

<a href="foo.html" onclick="newPop();">Foo</a>

should be

<a href="foo.html" onclick="newPop(); return false;">Foo</a>

or (as newPop() always returns false):

<a href="foo.html" onclick="return newPop();">Foo</a>
Jørn Schou-Rode
Dead right! thanks much.
harry_T