Hi, mates
I'd like to close all sub windows created by a parent window in just one shot.I'd like to push a button in the parent window and closing all the sub windows related.
Any ideas?
:sexpulp:
Hi, mates
I'd like to close all sub windows created by a parent window in just one shot.I'd like to push a button in the parent window and closing all the sub windows related.
Any ideas?
:sexpulp:
You have to know the name or the object associated to all the windows you have to close.
To close one window that you opened with:
var win1 = window.open(...);
you have to give the JS command:
win1.close();
If you don't know the object of the window, or you have lost it (e.g while you have changed the page in the main window), you have to re-open the window:
var win1 = window.open('','NAME_OF_WINDOW');
win1.close();
You can also put the code inside a loop, but the code in this case depends too much on the context, so it is difficult to explain without knowing more details of your specific problem.
Nuova politica di maggiore severita` sui titoli delle discussioni: (ri)leggete il regolamento
No domande tecniche in messaggi privati
I do not know the name and the number of opened sub windows![]()
.Could I use an array of windows?
It does not exist an array of windows in JS.
You can save the objects of the windows in an array, while you are opening them, and then you can use the contents of that array to close them all.
The windows are handled by the operating system, not bye the javascript. So if you don't have the object conneted to the windows (ore their names) you are not allowed to destroy them.
Nuova politica di maggiore severita` sui titoli delle discussioni: (ri)leggete il regolamento
No domande tecniche in messaggi privati
I found it.
I use eval(nameDynamicWindow+"="+"window.open'<indirizzo >', "" , "");");
and eval(nameDynamicWindow+".close();");
to close them
thank u as well
I don't think it is correct.
The eval() function is obsolete and deprecated (in some browsers may not function).
But anyway it lacks at least one character (parentesis) and the name of the window.
It is equivalent to the second method I gave you in my first post.
Nuova politica di maggiore severita` sui titoli delle discussioni: (ri)leggete il regolamento
No domande tecniche in messaggi privati