Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Window | Q1706 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.