Open a window with parameter setting - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window open

Description

Open a window with parameter setting

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Foo</title> 
   </head> 
   <body> 
      <input type="button" id="the-button" value="Click me"> 
      <script>
var w = 400, h = 600; top = 1, left = 1;
document.getElementById("the-button").onclick = function() {
    var newWindow = window.open('http://java2s.com', 
                                'PopupChat', 
                                'directories=no,location=no,menubar=no,titlebar=no,toolbar=no,scrollbars=yes,status=no,width=' + w + ',
                                height=' + h + ',top=' + top + ',left=' + left);
};

      </script>  
   </body>//from w  w  w  .  ja  va 2 s .  com
</html>

Related Tutorials