Skip to content

Instantly share code, notes, and snippets.

@ihsanberahim
Created October 31, 2013 05:03
Show Gist options
  • Save ihsanberahim/7244599 to your computer and use it in GitHub Desktop.
Save ihsanberahim/7244599 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<button onclick="javascript:popup('http://google.com','test',600,400)">Open</button>
</body>
</html>
function popup(_url,_windowName,_width,_height) {
var left = (screen.width/2)-(_width/2);
var top = (screen.height/2)-(_height/2);
var params = [
'resizable=yes',
'scrollbars=yes',
'toolbar=no',
'menubar=no',
'location=no',
'directories=no',
'status=yes',
'width='+_width,
'height='+_height,
'top='+top,
'left='+left
];
window.open(_url,_windowName,params.join(','));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment