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

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

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

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

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?'


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.