Results 1 to 5 of 5

Thread: Can't close DHTML Window Widget (??)

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

    Thumbs down Can't close DHTML Window Widget (??)

    1) Script Title: DHTML Window widget (v1.1)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ndow/index.htm

    3) Describe problem:
    I can open a window from a given page and populate it, but I can't seem to call the close() or hide() property from the opened window. I can call it from the "original" window, but nothing I do will allow me to close the window *from* the opened window.

    For example, say I've opened a window named "wizbox".

    I've tried:
    "wizbox.close() ", "window.opener.wizbox.close()", and ""window.opener.wizbox.hide()" from the popup window to no effect.

    What I'm doing is loading an entry form into the popup window...when the user submits the form I'd like to have the form get submitted and the widow be hidden or closed (either is fine).

    Here's how I'm opening the window:

    HTML Code:
    <script type="text/javascript">
    function openmypage(){
    wizwin=dhtmlwindow.open("wizbox", "iframe", "/trkwizard.htm", "Form Wizard", "width=590px,height=350px,resize=1,scrolling=1,center=1");
    }
    </script>
    I then open this window with a button:
    HTML Code:
    <input type="button" value="Form Wizard" onClick="openmypage(); return false">
    It opens fine, and I can close the popup window from the original 'base' window by doing either "onClick='wizwin.hide();' OR onClick='wizbox.hide();' (It seems like only one should work, but heck if I know...) but I cannot seem to close it from the popup window itself.

    I really, really, really want to use this script. What am I missing, or doing wrong?


  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try this:
    Code:
    <script type="text/javascript">
    var wizwin = "null"; //make it global
    function openmypage(){
    wizwin=dhtmlwindow.open("wizbox", "iframe", "/trkwizard.htm", "Form Wizard", "width=590px,height=350px,resize=1,scrolling=1,center=1");
    }
    </script>
    Jeremy | jfein.net

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

    Default

    I made the change as suggested:
    Code:
    <script type="text/javascript">
    var wizwin = "null"; //make it global
    function openmypage(){
    wizwin=dhtmlwindow.open("wizbox", "iframe", "$web_path/trkwizard.htm", "Tracker Wizard", "width=590px,height=350px,resize=1,scrolling=1,center=1");
    }
    </script>
    But, nope, still no go. What should I be calling from the popup page:

    wizwin.hide();

    or

    window.opener.wizwin.hide();

    or something else?? (I can post more of the code if necessary.)

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

    Default

    Assuming you've opened a window from your main page using the code:

    Code:
    wizwin=dhtmlwindow.open("wizbox", "iframe", "/trkwizard.htm", "Form Wizard", "width=590px,height=350px,resize=1,scrolling=1,center=1");
    To close this window from within "wizbox", or (trkwizard.htm), the code would be:

    Code:
    parent.wizwin.close()
    DD Admin

  5. The Following User Says Thank You to ddadmin For This Useful Post:

    Mike2000 (09-13-2008)

  6. #5
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much! That did the trick.

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
  •