JS: Pop-up New Window

By Xah Lee. Date: . Last updated: .

This page shows a JavaScript example of popping up a window.

to popup a window.

HTML code:

<p>
<button id="button02024" type="button">Click Me</button>
to popup a window.
</p>

JavaScript code:

const button02024 = document.getElementById("button02024");

const f_popup = (() => {
    // window.open(URL, name, spec)
    const myWin = window. open( "ex/pop_me.html", "Alice", "width=400, height=300, left=100");
    myWin.focus();
});

button02024.addEventListener("click", f_popup , false);

DOM How-To


Web Scripting Overview


HTML Input


Web Scripting Examples


Web Scripting Misc


jQuery


node.js

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials