Click to See Complete Forum and Search --> : launching and closing windows


cspierings
07-10-2003, 01:16 PM
I'll try to explain the situtation I'm dealing with and then ask my question.

We are being asked to develop a web app to help support customer service calls. A single page will come up with link to other information. The customers would like the links to open new windows. No problem doing that. What they want though is to have means to close all the windows opened from the first window without having to individually close each one.

Anyone have any ideas on whether this can be done? Can you point me in the right direction to look into how this can be done?

Thanks

Chris

Khalid Ali
07-10-2003, 01:18 PM
Yes store window references in an array and have a button to call a function that will go through the array and close all of th eoopened windows..

Jona
07-10-2003, 01:22 PM
Name them all numerical order, like so:


<script type="text/javascript">
var win = new Array(3);
</script>
<a href="default.html" onClick="win[0] = window.open('default.html', 'win0'); return false;" target="win0">Text</a><br>
<a href="page2.html" onClick="win[1] = window.open('page2.html', 'win1'); return false;" target="win1">Text</a><br>
<a href="page3.html" onClick="win[2] = window.open('page3.html', 'win2'); return false;" target="win2">Text</a><br>
<a href="#" onClick="for(i=0;i<win.length;i++){
if(win[i]){win[i].close();}
}">Close All</a>


[J]ona

cspierings
07-10-2003, 01:37 PM
Thanks for the tips.

I'm trying to save the references to an array and going the route of having a function clean them.

Chris

Jona
07-10-2003, 01:41 PM
Huh? :confused:
Re-test the code I posted (I've edited it and it works).

[J]ona