View Full Version : DHTML Window IE question

02-22-2005, 09:01 PM



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(){

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

Thanks for any help-

02-24-2005, 05:19 PM
Simply modify function closeit() so it becomes:

function closeit(){

02-24-2005, 05:46 PM
THANKS! Works perfect!

03-15-2005, 04:17 AM
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!

03-15-2005, 05:52 AM
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.

03-15-2005, 10:35 PM
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!

03-16-2005, 04:43 AM
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):

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
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"
minrestore=0 //restore window
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:

<DIV onmouseup=stopdrag() onselectstart="return false" onmousedown=initializedrag(event)to this:

<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.