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

Lesson 5. Adding User Interactivity > Adjusting Placement of the New Window

Adjusting Placement of the New Window

When you tested the Lake Tahoe cycling page, the lingo.html page opened in a new browser window, but you had no control of the exact placement of the window. You can add some parameters to the JavaScript code to place the window exactly where you want it. You can position the page against the top and left part of the screen, but 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.

1.
In the lake_tahoe.htm document, switch to code view by choosing Window > Code Inspector or clicking the Show Code View button in the toolbar.

Look for the <body> tag. You'll see some code like this:

onLoad="MM_openBrWindow('lingo.htm','lingo','toolbar=yes,location=yes,
status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=275,height=600')"

2.
After the height parameter, type the following code: screenX=0,screenY=0,top=0,left=0.

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.

TIP

Make sure to place the code before the single quote.

The resulting code should look like this:

onLoad="MM_openBrWindow('lingo.htm','lingo','toolbar=yes,location=yes,
status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=275,height=600,
screenX=0,screenY=0,top=0,left=0')"

3.
Save your page and test it in the browser.

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

4.
Change all four parameters to 20; notice the difference when you view the page in the browser.

The new window displays in a different position.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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