faqts : Computers : Programming : Languages : JavaScript : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

105 of 138 people (76%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How to position a window on the screen?

Feb 25th, 2000 08:10
Martin Honnen,


When you open a window you can with IE4/5 set
   left/top
in the feature string and with NN4/5 set
   screenX/screenY
so together you get for example
   open ('whatever.html', 'windowName', 
         'left=100,screenX=100,top=100,screenY=100')
where you can of course add further features like 
width/height/scrollbars/menubar etc.
Once a window is open you can move it with NN4/5 and IE4/5 calling the
  moveTo
or
  moveBy
method of the window object e.g.
  var w = open ('whatever.html', 'windowName');
  w.moveTo (100, 100);
or
  w.moveBy (20, 20)

To read the current coordinates of a window use
  window.screenLeft
  window.screenTop
for IE and
  window.screenX
  window.screenY
for NN