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

Lesson 12. Editing the Code > Adjusting New Window Placement

Adjusting New Window Placement

You learned how to control the attributes of new windows in Lesson 5 with the Open Browser Window behavior. By editing the HTML in Code View, you can also control the placement of those windows.

Preview the lighthouse_history.html document in your primary browser. Click the fuel cells link.

A new browser window opens with the definition of fuel cells. You created new windows like this one using the Open Browser window to select the fuel.html file, but you had no control over the exact placement of the window. You can control the placement by adding certain parameters to the JavaScript code to place the window in an exact location on the visitor's screen.

In the lighthouse_history.html document, look in the Code View pane for the code that opens the new browser when the visitor clicks the fuel cells link.

You'll see some code like this:

							<a href="#" onClick="MM_openBrWindow('fuel.html','definition',
							'scrollbars=yes,width=300,height=100')">fuel cells</a>

After the value of the height parameter, type , (a comma) and the following code: screenX=0,screenY=0,top=0,left=0.

Be sure to type the comma and code after the numeric value of 100 and before the single apostrophe. Do not include any spaces.

The screenX and screenY parameters are for Netscape 4.0 and later; they position the window at the top and left side of the screen. The top and left parameters are for Internet Explorer 4.0 and later; they do the same thing as screenX and screenY. Using a parameter of 0 will place the new window at those coordinates—in the top left corner of the screen.

The resulting code should look like this:

							<a href="#" onClick="MM_openBrWindow('fuel.html','definition',
							screenX=0,screenY=0,top=0,left=0')">fuel cells</a>

Save your page and test it in the browser.

The new window displays at the top and left side of your screen.


You should close the fuel cells definition window that you viewed earlier before previewing your page.

Change all four parameters to 300, and see the difference when you view the page in the browser.

The new window displays in a different position.

When defining the placement of a new browser window, be careful not to position the window too far down or too far to the right; users who have smaller monitors might not be able to see your window if the coordinates place the window outside the dimension of their screen.



Not a subscriber?

Start A Free Trial

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