Results 1 to 2 of 2

Thread: DHTML Window widget (v1.1) - window 4 get to stay open until closed manually

  1. #1
    Join Date
    Feb 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML Window widget (v1.1) - window 4 get to stay open until closed manually

    1) Script Title: DHTML Window widget (v1.1) - Window 4 - get to stay open until closed manually?

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

    3) Describe problem: Hi - I'm new to the forum. I have installed the DHTML window and would like to find out if it is possible to have the window KEEP OPEN until it is clicked closed by the user.

    In my use, I have the window opening by a click (I don't have it popping up up automatically). Please visit http:// www.hydrowest.ca/index.html and click on Vancouver "magnifying glass" map graphic to view in action. What I'd like is to see if once that vancouver map is clicked open, if I can keep it alive on the page while people click and navigate out of the index (when they are looking at the individual projects) and back to the index page to look at the next project in that map. As you see right now, it's inconvenient to have to keep opening the map again each time.

    I realize that a possible solution would be to have the project pages open in new windows, but I am hoping not to have to do that (may be confusing for some people that are using the website)

    Thanks for your help!
    Diana

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

    Default

    Try this. Use a session only cookie to indicate a DHTML window is open once that's the case. Here's an example, with the interesting parts highlighted in red:

    Code:
    <script type="text/javascript">
    
    function openwindow(){
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")
    document.cookie="googlewin=1"
    }
    
    if (document.cookie.indexOf("googlewin")!=-1) //if "googlewin" DHTML window has been opened previously within this browser session
    	openwindow() //open it again when the page loads
    
    
    </script>
    
    <a href="#" onClick="openwindow(); return false">Open DHTML window "googlewin"</a>
    The above link when clicked on calls openwindow(), an arbitrary function that in turn opens a DHTML window using the documented syntax and assigns the result to the variable "googlewin". The code in red then uses JavaScript cookies to indicate that this window has been open. Following this function is a check for whether this DHTML window was previously open (within the current browser session), and if so, automatically open the window again when the page loads, by calling openwindow().

    You should be able to adapt the above example to work for your own code.
    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
  •