Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Window Position

Status
Not open for further replies.

Mat

Programmer
Joined
Jun 6, 1999
Messages
8
Location
CA
Q: I set the Height and Width of a newWindow but how can I set the position (Left and Top)or Screen centered. I use this code: newWindow = window.open('', 'newWin', 'toolbar=no, location=no, scrollbars=yes, status=no, menubar=no, resizable=no, alwaysraised=yes, dependent=yes, width=620, height=400, screenx=150, screeny=50') and each time load the page in a different position.
 
Maybe you need to give it a location; I'm not QUITE sure what's wrong with it, but that may well be a PART of your problem.<br>
<br>
Sorry I couldn't be of more help.<br>
<br>
<br>
-robherc<br>
robherc@netzero.net
 
This is the code that I use to create a dynamic splash screen. It works in Netscape 4.61 and IE 5.x under Windows NT 4.0. Hope it helps.<br>
<br>
<br>
// find the center of the screen, and compensate for the <br>
// size of the new window to to center it.<br>
centerX = screen.width/2 - 125<br>
centerY = screen.height/2 - 50<br>
<br>
windProps = "HEIGHT=100,WIDTH=250,TOP=" + centerY + ",LEFT=" + centerX <br>
<br>
splashWind = window.open("", "splashScreen", windProps)
 
This is how I POP a smaller window up:<br>
This goes up in the &quot;HEAD&quot; of the HTML file..<br>
&lt;script language=&quot;JavaScript&quot;&gt;<br>
&lt;!-- ;<br>
function openWin(URL) {<br>
aWindow = window.open(URL,&quot;newwindow&quot;,&quot;resizable=yes,width=315,height=165,<br>
top=120,left=450,scrollbars=no&quot;);<br>
}<br>
// end hide --&gt;<br>
&lt;/script&gt;<br>
<br>
And this is the actual function that is called to make it happen down in the &quot;BODY&quot;:<br>
<br>
&lt;A HREF= &quot;javascript:openWin('FILENAME.htm');&quot; OnMouseOut=&quot;window.status=''; return true&quot; OnMouseOver=&quot;window.status=''; return true&quot;&gt;CLICK HERE&lt;/a&gt;<br>
<br>
Hope this helps...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top