JavaScript: 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);
βˆ‘ JS in Depth
XAH Β BUY NOW

JS in Depth

JS Obj Ref

DOM


DOM

Overview

Basic Examples

HTML Input

Web Scripting Examples

Web Scripting Misc

jQuery

node.js