Here's the code I recommend:
Code:
var newWin = null;
function popUp(strURL, strType, strHeight, strWidth) {
if (newWin != null && !newWin.closed)
newWin.close();
var strOptions="";
if (strType=="console")
strOptions="resizable,height="+
strHeight+",width="+strWidth;
if (strType=="fixed")
strOptions="status,height="+
strHeight+",width="+strWidth;
if (strType=="elastic")
strOptions="toolbar,menubar,scrollbars,"+
"resizable,location,height="+
strHeight+",width="+strWidth;
newWin = window.open(strURL, 'newWin', strOptions);
newWin.focus();
}
To call the function you would use the following code:
Code:
<a href="my-pop-up-window.htm"
onclick="popUp(this.href,'console',400,200);return false;"
target="_blank">This is my link</a>
You can put a condition to close the popup too.
Bookmarks