Skip to content
Related Articles

Related Articles

HTML | Window createPopup() Method
  • Last Updated : 11 Oct, 2019

The createPopup() method in html window is used to create a pop-up window.

Syntax:

window.createPopup()

Example:




<html>
  
<head>
    <title>
      DOM createPopup() Method
  </title>
    <style>
        h1 {
            color: green;
        }
    </style>
</head>
  
<head>
    <script type="text/javascript">
        function show_popup() {
            var pop = window.createPopup()
            var popbody = pop.document.body
            popbody.style.backgroundColor = "lime"
            popbody.style.border = "solid black 1px"
            popbody.innerHTML = 
              "I am the pop-up, Click outside to close."
            pop.show(150, 150, 200, 50, document.body)
        }
    </script>
</head>
  
<body>
    <center>
        <h1>
          GeeksforGeeks
      </h1>
        <button onclick="show_popup()">
          pop-up!
      </button>
    </center>
</body>
  
</html>

Output:

Note: The Window createPopup() Method works before Internet Explorer 11.

Supported browser:

  • Google Chrome: NO
  • Mozilla Firefox: NO
  • Edge: NO
  • Opera: NO
  • Safari: NO



My Personal Notes arrow_drop_up
Recommended Articles
Page :