View Single Post
  #2 (permalink)  
Old September 4th, 2003, 03:24 AM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

To close a window execute the close method. If you did not open the window via script there will normally be a warning message, this can be avoided by some older and unpatched browsers. To close the window you are in via a link:
Code:
  <a href="#" onclick="window.close();return false;">Close me</a>
To close windowopened from the opening window:
Code:
  var oNewWin;

  function openNewWin()
  {
    oNewWin = window.open(...);
  }

  function closeNewWindow()
  {
    oNewWin.close();
  }
  <a href="#" onclick="openNewWin();return false;">Open New Window</a>
  <a href="#" onclick="closeNewWin();return false;">Close New Window</a>
--

Joe
Reply With Quote