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

Q1706 How can I randomly open one of 100 windows named 1.htm to 100.htm?

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

Try:

<script language="JavaScript"><!--
function openRandom(i) {
  window.open(i + '.htm','windowName');
}
//--></script>

<form>
<input type="button" value="Open" onClick="openRandom(Math.floor(Math.random() * 100) + 1)">
</form>

©2018 Martin Webb