Window Management functions are those that allow the user to work with windows. These functions include the ability to define, open, close, write to, determine if a window is open or closed, and determine the number of windows defined or open.

Use

When dealing with a windows environment, keeping track of all the windows (e.g., is the window open or is it closed) is one of the hardest tasks. These window management functions are designed to be an integrated set of tools for the developer to manage windows in a Web browser environment. These functions differ from conventional browser window management as they allow the user to manipulate the windows based on the window name instead of the window handle.

The most effective way to use these functions is to start with a template Web page that incorporates all the JavaScript Vision window management functions.

<HTML>
<HEAD>
    <TITLE>Your Title Goes Here</TITLE>
    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_Globals.js"></SCRIPT>
    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_String.js"></SCRIPT>
    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_HTML.js"></SCRIPT>
    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_Numeric.js"></SCRIPT>
    <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_WindowMgmt.js"></SCRIPT>
</HEAD>

<BODY BGCOLOR="#FFFFFF"
      onLoad="JSV_onLoad();" onUnload="JSV_onUnload();"
      onBlur="JSV_onBlur();" onFocus="JSV_onFocus();"
      onResize="JSV_onResize();">

<FORM ACTION="formPost.cfm" METHOD="POST" onSubmit="JSV_onSubmit();">

<!-- Your form goes here -->

</FORM>

</BODY>
</HTML>

From this start, the user can make any additions to the page as needed and include other window management functions to open, close, focus, and blur the child windows needed to accomplish the purpose of the parent Web page.

Window Management Functions
JSV_defineWindow JSV_closeWindow
JSV_openWindow JSV_focusWindow
JSV_isWindowOptionSet JSV_blurWindow
JSV_numberOfWindowsDefined JSV_closeAllWindows
JSV_isWindowDefined JSV_documentWrite
JSV_numberOfWindowsOpen JSV_documentClose
JSV_isWindowOpen  
JSV_isWindowClosed JSV_hyperLink

Window Event Handlers
The onLoad, onUnload, onBlur, onFocus, onResize event handlers are specified in the BODY tag but are actually event handlers for the window object.

If you find it necessary to create a function that will perform other functionality for the window event handlers, or the onSubmit event handler for the FORM tag, then be sure to include the appropriate JavaScript Vision window function as the last call in your new function.

Example

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
function onFormSubmit() {
    var submitForm = true;
    // Your code goes here

    if (submitForm) submitForm = JSV_onSubmit();
    return submitForm;
}
</SCRIPT>
<FORM ACTION="formPost.cfm" METHOD="POST" onSubmit="onFormSubmit();">
</FORM>

The developer may want to ensure that the user enters data into, or sees the information on, a child window. This is where the JSV_stayOnTop function plays a vital role to keep the child window on top until the user closes it. Once the child window is closed, then other windows can be accessed.

Lastly, to assist the developer in managing windows, the JSV_showWindowDefintion function was developed to display all window attribute settings of a window created with JSV_openWindow, or defined by JSV_defineWindow.

Remarks

For more information on the SRC attribute of the SCRIPT tag, see JavaScript Vision Frequently Asked Questions.

See

JavaScript Pop-Up Windows Primer

for an introduction to JavaScript pop-up windows; and

20 JavaScript Window Tips
JavaScript does windows
A function for all windows
Opening windows using JavaScript
Window features
Communicating between windows