[Javascript] positioning: window.open()

Alan Easton alan.easton at unn.ac.uk
Thu Apr 5 04:03:22 CDT 2001


Hi Tom,

I use this code to pop up a new window, using left and top co-ordinates:

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function flash() {
window.open("your_url_here.htm","","height=535,width=780,left=5,top=5");

}
// End -->
</script>

And it launches by calling the function as such: <a
href="javascript:flash()">Launch</a>

Hope this helps you in some way.

Alan...

-----Original Message-----
From: Tom Churm [mailto:thomas.churm at pixelpark.com]
Sent: Thursday, April 05, 2001 9:30 AM
To: javascript at LaTech.edu
Subject: [Javascript] positioning: window.open()



hi,
i usually use this code to open a new "pop-up window":

<script language="JavaScript">
<!--
function openHelpWindow () {
  helpWindow = window.open ("popup.html", "MyWindow", 

"menu=no,toolbar=no,location=no,scrollbars=no,width=800,height=600,res

izable=no");
  helpWindow.moveTo((screen.width-420)/2, (screen.height-310)/2);
  helpWindow.focus();
}
// -->
</script>

i've found that there are errors when an Absolute URL is used, ie: 

when the URL for "popup.html" is something like 

"http://someserver.com/popup.html".  since i frequently need to center 

or position pop-ups, i need to find an alternative.

i saw somewhere coding that uses something like top=100; left=200; to 

position a new window, but cannot find any references to this.

any suggestions would be greatly appreciated.

thanks,

tom

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list