createPopup method
[createPopup is no longer supported. Starting with Internet Explorer 11, use a div, iframe, or other element with a relatively high z-index value. For info, see Compatibility changes.]
Creates a popup window object.
Syntax
var retval = window.createPopup(varArgIn);Parameters
- varArgIn [in, optional]
-
Type: string
This argument is reserved.
Return value
Type: Object
Returns a popup window object.
Standards information
There are no standards that apply here.
Remarks
The pop-up window is initially in a hidden state.
When an element has focus and causes a popup to appear, the element does not lose focus. Because of this, an onblur event associated with an element that creates a popup will not occur when the popup is displayed.
Windows Internet Explorer 8. Windows created with createPopup inherit the zoom state of windows that created them.
Windows Internet Explorer 7 and later. By default, windows created with the createPopup function are displayed in IE5 (Quirks) mode compatibility mode (also called "quirks" mode), regardless of the display mode of the webpage that created them. To display standards-based content in a popup window, use document.location location to load an external document into the popup window. When you do this, the popup window will render the content according to the document compatibility mode of the loaded content. For information, see Defining Document Compatibility.
Microsoft Internet Explorer 6 for Windows XP Service Pack 2 (SP2) places several restrictions on windows created with this method. Restricted properties include size, screen position, and z-order. For more information, see About Window Restrictions.
Examples
The following example shows how to use the createPopup method to create and display a pop-up window.
<!DOCTYPE html>
<html>
<head>
<title>Popup Example</title>
<script>
var oPopup = window.createPopup();
function ButtonClick() {
var oPopBody = oPopup.document.body;
oPopBody.style.backgroundColor = "lightyellow";
oPopBody.style.border = "solid black 1px";
oPopBody.innerHTML = "Click outside <strong>popup</strong> to close.";
oPopup.show(100, 100, 180, 40, document.body);
}
</script>
</head>
<body>
<button onclick="ButtonClick()">Click Me!</button>
</body>
</html>
See also