p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   HTML Code Clinic (http://p2p.wrox.com/forumdisplay.php?f=90)
-   -   How do i close pop-up window?: window.close () (http://p2p.wrox.com/showthread.php?t=3431)

Burton September 3rd, 2003 03:32 AM

How do i close pop-up window?: window.close ()
 
Hi [8)]

Just incase some people neglect my query below due to the three replys, thinking it is dealt with, I allow myself to give this question a new post.

How do I make a "close window" link (like in this forum when you preview your reply before sending):

Here's the body:

<body>
<p>
<a href="PICTURE.jpg" OnClick="window.open('PICTURE.jpg', 'big', 'fullscreen=yes'); return false"><img border="0" src="PICTURE.jpg" width="172" height="129">
</a>
</body>

What do I need? Something like this, or is this too complicated?:
"javascript:window.close()">Close Window<


joefawcett September 4th, 2003 03:24 AM

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

Burton September 8th, 2003 05:40 AM

Hi Joe,

Thanks for your reply. Please copy & paste my script from above and add your code within, as I don't know where to put the "var oNewWin". (sorry, I'm just a novice [:o)])

So you think this will work within my pop-up window, even though it is just a JPEG-image? (not a HTML document, as pgtips stated in topic above)

Hope to read from you soon, thanks a lot ;)



All times are GMT -4. The time now is 09:19 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.