Results 1 to 4 of 4

Thread: close window with js

  1. #1
    Join Date
    Oct 2015
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default close window with js

    Sorry, been out of the loop on js for a while and need to fix a page. Could someone help me out? From one page(Win1), I open a second with js (win2), which presents results of data collected on that page (win2) on win 3, also opened and written from win2 with js. I would like win2 closed when win 3 is opened. Is that possible, dependably.
    thx.

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Hmmm, you've forgotten to include your code but if you haven't got that far, maybe start your research here https://www.google.co.uk/search?q=cl...dow+javascript

    And if you need more help, please provide a reduced case setup to demonstrate the behaviour. Also include the code you've written to close the window so that we can make suggestions on fixing the parts that dont work as expected.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    A very simple and effective solution is to just clear the contents of the current window and then rewrite them. This line is very useful:

    Code:
    document.getElementsByTagName('body')[0].innerHTML="";
    Use with caution as it will clear everything (including scripts) that is contained between the <body> and </body> tags!

  4. The Following User Says Thank You to styxlawyer For This Useful Post:

    BCRandCo (10-26-2015)

  5. #4
    Join Date
    Oct 2015
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks. That will work well.
    Last edited by BCRandCo; 10-26-2015 at 02:10 AM.

Similar Threads

  1. Window Widget hide close button, close with esc
    By twright6 in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 03-03-2012, 03:00 PM
  2. Replies: 0
    Last Post: 04-20-2010, 01:31 PM
  3. Internet Explorer 8 Window won't close DHTML Modal window v1.1
    By pyxism in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 02-13-2010, 08:59 AM
  4. DHTML Modal window: close window when veil is clicked?
    By Luterin in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 10-10-2007, 05:14 PM
  5. DHTML Window Widget: Close Window-Layer(s) While Opening Another
    By twohawks in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 10-06-2007, 07:03 PM

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
  •