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:

<button id="id46415">Click Me</button>

JavaScript code:

function f1() {
    // window.open(URL, name, spec)
    var xWin = window.open( "ex/pop_me.html", "Alice", "width=400,height=300,left=100");
    xWin.focus();
}

document.getElementById("id46415").addEventListener("click", f1 , false);

Simple DOM Examples

  1. JS: Change CSS
  2. JS: Change Element's Content
  3. JS: Create HTML Element
  4. JS: Remove HTML Element

  1. JS: document.write
  2. JS: Image Rollover
  3. JS: Pop-up New Window
  4. JS: Digital Clock
  5. JS: Stopwatch
  6. JS: Fade a Element
  7. JS: Fade a Element Using CSS Transition
  8. JavaScript UI: Shake Element
  9. JS: How to Create Tooltip
  10. JS: Falling Snow Effect
  11. JavaScript Floating Box Following Scroll
Like what you read? Buy JavaScript in Depth