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

Q1416 How can I open a popup window and position it relative to the existing window?

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

Try the following:

<script language="JavaScript"><!--
var x = 0, y = 0; // default values

if (document.all) {
  x = window.screenTop + 100;
  y = window.screenLeft + 100;
}
else if (document.layers) {
  x = window.screenX + 100;
  y = window.screenY + 100;
}

var popup = window.open('popup.htm','popup','width=100,height=100,top='+y+',screenY='+y+',left='+x+',screenX='+x);
//--></script>

Feedback on 'Q1416 How can I open a popup window and position it relative to the existing window?'

©2018 Martin Webb