Javascript: On function close all windows

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Javascript: On function close all windows

Post by tecktalkcm0391 »

I wanted to make a function that would close all windows (it created) starting with window. How would I do something like this. Just some clues/hints would be awsome, but you could make it easy and give me some code! :wink: :wink: :wink: <-- Yeah I know what your all going to say, Giving code doesn't help the person.... well believe it or not as long as there is a explaination, ppl learn, well at least I do cause then when I need something like it again I go back to that code and figure out how change... and there is were ppl learn!

^
^
^
Sorry about that.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Don't have the code but you should keep track of all the windows you open in an array. Then loop through the array and close them.

As another alternative...
window.open has an option "dependant". When you close the parent window all dependant windows close. Maybe you could use this...
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

How would I do the array thing, and/or the window.open thing
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

tecktalkcm0391 wrote:How would I do the array thing, and/or the window.open thing
By reading how the basics of Javascript work and by reading the link he gave you, respectively.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I am getting a book for Javascript, and I don't know how I didn't see his link!
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

CoderGoblin wrote:Don't have the code but you should keep track of all the windows you open in an array. Then loop through the array and close them.

As another alternative...
window.open has an option "dependant". When you close the parent window all dependant windows close. Maybe you could use this...
Thanks I'll def. use the dependant variable.
Post Reply