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

6. Managing Browser Windows > 6.5. Bringing a Window to the Front

Bringing a Window to the Front

NN 3, IE 4

Problem

You want to bring a window that is buried beneath other windows back to the top of the pile.

Solution

For any window to which you have a valid reference, invoke the focus( ) method. The following function expands on topics addressed in Recipe 6.4. This expanded function not only opens a subwindow, but brings it forward if it was previously opened, and remains so underneath the main window:

var newWindow;
function makeNewWindow(url) {
    if (!newWindow || newWindow.closed) {
        newWindow = window.open(url,"subwind","status,height=200,width=300");
    } else {
        // window is already open, so bring it to the front
        newWindow.focus( );
    }
}

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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