Results 1 to 3 of 3

Thread: How to close dhtml window on click of a button?

  1. #1
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to close dhtml window on click of a button?

    1) Script Title: dhtmlwindow

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

    3) Describe problem: I open a new dhtml window with iframe option along with a URL. URL is a HTML page having some text and a button. How can I close the dhtml window on click of this button? Also how can I call Javascript functions written on the parent page from dhtml window?

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Please do a search- how to have code inside a DHTML window call a function from the opening parent window has been answered many times. Regarding your question, assuming you've opened your window using something like:

    Code:
    var mywindow=dhtmlwindow.open("mybox", "iframe", "test.htm", "Test site", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")
    On test.htm, the code to close this DHTML window would be:

    Code:
    parent.mywindow.close()
    In other words, add "parent." in front of the DHTML window's variable to refer to it from the DHTML window page. Same goes for accessing variables in the parent window.
    DD Admin

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
  •