MathCurvesSurfacesWallpaper GroupsGallerySoftwarePOV-Ray
ProgramingLinuxPerl PythonHTMLCSSJavaScriptPHPJavaEmacsUnicode ♥
19dfoa3Q7oehm9MwCULQzBG8vqfCaeMazH
Web Hosting by 1&1

JavaScript: Pop-up a New Window Example

Programer for Hire

Xah Lee, ,

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

to popup a window.

HTML code:

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

JavaScript code:

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

document.getElementById("id0cd33").onclick = f1;

If you have your browser set to open new window in tab, the pop-up will be just a new tab.

https://developer.mozilla.org/en/DOM/window.open

blog comments powered by Disqus