window.open() : Window Object : Window JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Window » Window Object »

 

window.open()












Syntax








window.open(pageURL, name, parameters)




The open() method creates a new instance of a window. It loads the pageURL. The ACTION attribute of the


tag and the TARGET attribute of the

You must use comma to separate each of these options and do not insert any spaces.

Parameters That Can Be Passed When Creating a New Window












































































































Parameter Initialize With Description
alwaysLowered yes/no tells the window to stay behind all other windows. This must be done in signed scripts.
alwaysRaised yes/no tells the window to stay on top of all other windows. This must be done in signed scripts.
dependent yes/no opens the window as a true child window of the parent window.
directories yes/no Specifies if the Directory Bar on Navigator 2 and 3 is visible.
height pixel value Sets the height of the window.
hotkeys yes/no Disables all but the Security and Quit hotkeys in a new window with no Menu Bar.
innerHeight pixel value Sets the height of the document.
innerWidth pixel value Sets the width of the document.
location yes/no Specifies if the Location Bar is visible.
menubar yes/no Specifies if the Menu Bar is visible.
outerHeight pixel value Sets the height of the window, including the chrome.
outerWidth pixel value Sets the width of the window, including the chrome.
resizable yes/no Specifies if the window can be resized.
screenX pixel value Sets the distance of the window from the left side of the screen.
screenY pixel value Sets the distance of the window from the top of the screen.
scrollbars yes/no Specifies if the Scroll Bars are visible.
titlebar yes/no Specifies if the Title Bar is visible.
toolbar yes/no Specifies if the toolbar is visible.
width pixel value Sets the width of the window.
z-lock yes/no Specifies that the window is not supposed to be located above other windows when it is made active.















<html>
    <script language="JavaScript">
    <!--
    function openWin(){
      var myBars = 'directories=no,location=no,menubar=no,status=no';

      myBars += ',titlebar=no,toolbar=no';
      var myOptions = 'scrollbars=no,width=400,height=200,resizeable=no';
      var myFeatures = myBars + ',' + myOptions;
      var myReadme = 'This is a test.'

      var newWin = open('', 'myDoc', myFeatures);

      newWin.document.writeln('<form>');
      newWin.document.writeln('<table>');
      newWin.document.writeln('<tr valign=TOP><td>');
      newWin.document.writeln('<textarea cols=45 rows=wrap=SOFT>');
      newWin.document.writeln(myReadme + '</textarea>');
      newWin.document.writeln('</td></tr>');
      newWin.document.writeln('<tr><td>');
      newWin.document.writeln('<input type=BUTTON value="Close"');
      newWin.document.writeln(' onClick="window.close()">');
      newWin.document.writeln('</td></tr>');
      newWin.document.writeln('</table></form>');
      newWin.document.close();
      newWin.focus();
    }
    -->
    </script>
    <body>
    <form>
      <b>Click the following button to open a new window: </b>
      <input type=BUTTON value="Open" onClick='openWin()'>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Window
» Window Object