Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1682 How can I open or close multiple windows using a loop?

You are here: irt.org | FAQ | JavaScript | Window | Q1682 [ previous next ]

Try something like:

<script language="JavaScript"><!--
var openWind = new Array();

for (i=0; i<4; i++) {
  openWind[i] = window.open('page'+i+'.html','window'+i);
}

for (i=0; i<4; i++) {
  if (openWind[i] && !openWind[i].closed) openWind[i].close();
}
//--></script>

©2018 Martin Webb