1. Javascript intro
  2. Javascript basics
  3. Javascript variables
  4. Javascript functions
  5. Javascript popup boxes
  6. Javascript conditions
  7. Javascript loops
  8. Javascript arrays
  9. Javascript objects
  10. Javascript strings
  11. Javascript events
  12. Javascript errors
  13. Javascript DOM
  14. Javascript elements
  15. Javascript new windows
  16. Javascript date & time
  17. Javascript cookies
  18. Javascript print
  19. Javascript redirect
  20. Javascript void
  21. Javascript summary

Javascript new window

Opening new windows (pop-up windows) has a bad reputation because of all those annoying pop-up ads people get, but there are legitimate reasons for opening new windows. For example, if you link to a page in an another website you might want to open it in a new window or if you want to display extra information you might want to display it in a new window.

This tutorial focuses on:

The function

The function is used to open new windows. function arguments

Syntax:"URL", "Name", "Properties");
<html> <head> <title>Javascript New Window</title> <script type="text/javascript"> function openNewWindow() { /* will open a new window with the URL named "GoogleWindow" with a width of 380 pixels and a height of 250 pixels */"", "GoogleWindow", "width=380, height=250"); } function openNewWindow2() { /* will open the page javascript-basics.php in a new window with the name "JavascriptBasics" with a width of 650 pixels and a height of 450 pixels with a menu bar, title bar, and tool bar, and ability to resize it */"javascript-basics.php", "JavascriptBasics", "width=650, height=450, menubar=yes, titlebar=yes, toolbar=yes, resizable=yes"); } </script> </head> <body> <input type="button" onclick="openNewWindow()" value="Open a new window" /> <input type="button" onclick="openNewWindow2()" value="Open another new window" /> </body> </html>
© Copyright 2013-2014
Terms of use | Privacy policy | Copyright information