Results 1 to 6 of 6

Thread: Nesting modal windows

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

    Default Nesting modal windows

    1) Script Title: DHTML Modal window v1.1

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

    3) Describe problem:
    My site: http://www.genuinesigns.com/modal/docroot/editor.php

    I would like to nest modal windows. I would like to have a button on one modal window that opens another modal window and when the second window closes the first one is displayed.

    Is this possible? It does not seem to work in the obvious way.

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

    Default

    I would like to have a button on one modal window that opens another modal window and when the second window closes the first one is displayed.
    I gather you simply mean a button within one modal window that opens another modal window in the same web page, not inside the former window (hence nested)? In other words, open multiple modal windows at the same time.
    DD Admin

  3. #3
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes. Multiple modal windows but only one active at a time. To the user it should appear like a stack.

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

    Default

    Well, opening multiple modal windows by itself is supported by the script. The windows would appear on top of one another, stacked. Just call dhtmlmodal.open() for each instance of a window you wish to open. So in your case, lets say you have the following code to open the very first modal window:

    Code:
    var agreewin=dhtmlmodal.open("agreebox", "iframe", "agreement.htm", "This Page's Terms of service", "width=590px,height=450px,center=1,resize=1,scrolling=0", "recal")
    Now, inside agreement.htm, you wish to show a link that opens another modal window. Such a link on that page would look like:

    Code:
    <!--This code appears in agreement.htm-->
    
    <script type="text/javascript">
    
    function modal2(){
    	confirmwin=parent.dhtmlmodal.open("confirmbox", "iframe", "confirm.htm", "Confirmation Window", "width=300px,height=400px,center=1,resize=1,scrolling=0", "recal")
    }
    
    </script>
    
    <a href="javascript:modal2()">Open Confirmation Window</a>
    Notice the ".parent" code in red- this is required when calling dhtmlmodal.open() on the parent page from the IFRAME page (both pages must be from the same domain). Also, notice the two variables in bold- these must be arbitrary, but unique variable names for each instance of a modal window on your page. In other words, don't use the same variable name when invoking another modal window.
    DD Admin

  5. #5
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks very much for your reply. I have been explaining myself badly.

    I can open windows from buttons on prior windows, but when I close that window the prior window is also closed.

    I am using a slightly different method to get a pointer to the javascript on the parent page. It does call the the correct functions so I don't think that is the problem.

    I had a theory that the onclose function for the nested window was causing the problem, but when I removed it the problem persists.

  6. #6
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I found my silly bugs causing this problem, thanks.

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
  •