Results 1 to 6 of 6

Thread: Help with window!!!

  1. #1
    Join Date
    Jun 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with window!!!

    Dear webmasters!
    Hey! I need help.... Can you answer my question??? Have you got any script to close window on your webpage???
    Please if you find any script, I will be happy!

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sure, this should work:

    <a href="javascript:window.close();">Close Window</a>

    It will prompt if it is not in a parent-owned popup window.

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Won't work in all situations because browsers are touchy about that sort of thing and constantly coming up with new ways to stop you but, here it is:
    Code:
    <script type="text/javascript">
    window.opener=""
    window.close();
    </script>
    Of course this will simply close the window, how you use it is up to you. Things are much simpler if the window you are closing was opened as a named variable by javascript ex:
    Code:
    <script type="text/javascript">
    var myWin=window.open('date.htm','dateWin')
    setTimeout("myWin.close()",5000)
    </script>
    This will open myWin and then close it after 5 seconds.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jun 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes! Thank you! But can I close 1 window in 2 ???
    I want to allow 1 window in 2!

  5. #5
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You've lost me now - try re-explaining?

    Thanks.
    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If you want to close two windows at once, you just have to do them one after the other in the code. If one of the windows you are closing is the one with the script, best to save it for last though, some browsers won't care.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •