• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

6. Managing Browser Windows > 6.2. Positioning the Main Window

Positioning the Main Window

NN 4, IE 4

Problem

You want to move the top-left corner of the browser window to a specific point on the screen.

Solution

Version 4 and later browsers provide two window object methods that adjust the position of the browser window: moveTo( ) and moveBy( ) . To move the window to a screen coordinate point, use the moveTo( ) method:

window.moveTo(10, 20);

To shift the position of the window by a known pixel amount, use the moveBy( ) method:

window.moveBy(0, 10);

The window remains the same size when you move it.

Discussion

The coordinate space of the screen is laid out such that the top-left corner of the video display area is point 0,0. The viewable area of your screen has positive coordinate values for both numbers. Negative values are “off the screen,” as are values that are larger than the number of pixels displayed on the screen.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint