Results 1 to 7 of 7

Thread: DHTML Window IE question

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

    Default DHTML Window IE question

    DHTML Window IE
    http://www.dynamicdrive.com/dynamici...htmlwindow.htm

    -------------------------

    Hi,

    Can somebody help a dhtml idiot with the above script. First off, it works great but I am trying to figure out how to get the dhtml window to refresh the main page. In other words, I have the window making a change to a database that I would like reflected on the page that it came from when you close the window. I presume that it would be in the following section:

    function closeit(){
    document.getElementById("dwindow").style.display="none"

    but being very new at dhtml I am unsure even what to search for to try to answer this question

    Thanks for any help-
    Guinness

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

    Default

    Simply modify function closeit() so it becomes:
    Code:
    function closeit(){
    document.getElementById("dwindow").style.display="none"
    window.location.reload()
    }

  3. #3
    Join Date
    Feb 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    THANKS! Works perfect!

  4. #4
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    This is a bit unrelated to the previous post, but I am wondering how I can implement this script to be able to open several of these on a page.

    So what I mean is that if I have three links, say:

    Link A
    Link B
    Link C

    How do make it so that each one opens in a separate DHTML Window? So that after I have clicked all of them, I have three of these DHTML Windows open, each with a different page loaded in them?

    Thanks for any help!

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default Multiple DHTML Windows from same page

    In a case like this, I usually prefer to modify the existing script to handle the new tasks. Looking at the script however, it seems there are a number of variables and functions that would be difficult to use this philosophy on. I think numerous flags and arrays would need to be created and utilized, it could get messy. For three windows, one could use three versions of the script on one page. Virtually, if not, all the variables and function names in each version would have to be given unique names, as well as the id's in the HTML and script code. For example, one version could be the script as it is written with its accompanying HTML. For a second version, add a '1' to the name of each function name, variable name and id name wherever they occur in the script and the HTML. You should be able to have as many as you want this way, just keep incrementing the number for each subsequent version. The real trick is to make sure you get them all consistent within each version and don't miss any that could conflict with another version on the same page. Too many of these scripts on a page will bog it down. The number depends on the client's bandwidth.

  6. #6
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for that! It worked great! A bit tedious, but worked nonetheless! I now have two other questions.

    1) Is it possible to have a minimize function where the windows minimize to some specified coordinate?

    2) How do I make it so that when I click on a given DHTML Window, it comes to the foreground. Right now I can open a bunch of these things up, but I can't bring one from the back to the front.

    Thanks for any help!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default Minimize/Focus

    There already is a function to set the minimize position. It just happens to be set to the upper lefthand corner. To change that, look in the code of the window you want to have in a different position when minimized. Replace the entire function maximize() with this code (make sure you get the whole thing and use the right names of things for that particular window):
    Code:
    function maximize(){
    if (minrestore==0){
    minrestore=1 //maximize window
    document.getElementById("maxname").setAttribute("src","restore.gif")
    document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
    document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
    document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
    document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
    }
    else{
    minrestore=0 //restore window
    document.getElementById("maxname").setAttribute("src","max.gif")
    document.getElementById("dwindow").style.width=initialwidth
    document.getElementById("dwindow").style.height=initialheight
    document.getElementById("dwindow").style.left=ns6? window.pageXOffset*1+30+"px" : iecompattest().scrollLeft*1+30+"px"
    document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
    }
    }
    Now your window will minimize to the 30/30 offset it had when it first launched. To make that something different still, look for the four numbers 30 on the last two written lines of this new function, adjust them accordingly. The first two must agree with each other (be the same number) and control the position of the left edge of the window. The second two must also agree and control the position of the top edge.

    Now to have these windows come forward when clicked let's try changing this at the begining of each window's HTML code:
    HTML Code:
    <DIV onmouseup=stopdrag() onselectstart="return false" onmousedown=initializedrag(event)
    to this:
    HTML Code:
    <DIV onmouseup=stopdrag() onselectstart="return false" onmousedown=this.focus();initializedrag(event)
    if that works, we lucked out and everyone's happy, let me know because I'm not setting up three of those windows just to test this out.
    Last edited by jscheuer1; 03-16-2005 at 06:24 PM. Reason: clarity

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
  •