You are here: Reference > JavaScript > client-side > dialog > properties > isOpen (popup)

isOpen property (popup)

Browser support:
Returns a Boolean value that indicates whether the current popup window is displayed.
Popup windows can be created with the createPopup method and displayed with the show method.

Syntax:

object.isOpen;
You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Boolean that indicates the state of the popup window.
One of the following values:
false
Popup window is displayed.
true
Popup window is closed.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the isOpen property:
<head>
    <script type="text/javascript">
        var popupWindow = null;
        function Init () {
            window.setInterval (UpdateInfo, 200);
        }

        function UpdateInfo () {
            var info = document.getElementById ("info");
            if (popupWindow && popupWindow.isOpen) {
                info.innerText = "popup window is open";
            }
            else {
                info.innerText = "popup window is closed";
            }
        }

        function MakePopup () {
            if (window.createPopup) {        //Internet Explorer
                if (!popupWindow) {
                    popupWindow = window.createPopup ();
                    var popupBody = popupWindow.document.body;

                    popupBody.style.backgroundColor = "lightblue";
                    popupBody.style.border = "solid black 1px";
                    popupBody.innerHTML = "Click outside to close.";
                }
                popupWindow.show (100, 100, 150, 25, document.body);
            }
        }
    </script>
</head>
<body onload="Init ()">
    <input type="button" value="Create a popup window!" onclick="MakePopup ();"/>
    <div id="info"></div>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content