JS: open popup window


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // construct for explorer compatibility
  2. var newwindow = '';
  3. // EG: pop_up_window("http://www.google.com", 200, 200)
  4. function pop_up_window(url, sizeh, sizew) {
  5. if (!newwindow.closed && newwindow.location) {
  6. newwindow.location.href = url;
  7. }
  8. else {
  9. newwindow=window.open(url,'name','height=' + sizeh + ', width=' + sizew + ', status=1, resizable=1, location=1, scrollbars=1 '); /*resizable=1*/
  10. if (!newwindow.opener) newwindow.opener = self;
  11. newwindow.moveTo(100,100);
  12. }
  13. if (window.focus) {newwindow.focus()}
  14. return false;
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.