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

Q1172 How can I cycle through a list of filenames in an array and show then in a text form field when a button is clicked?

You are here: irt.org | FAQ | JavaScript | Object | Q1172 [ previous next ]

Try:

<script language="JavaScript"><!--
var myFiles = new Array('file1.htm','file2.htm','file3.htm');

var i = 0;
//--></script>

<form>
<input type="text" name="files">
<input type="button" value="next" onClick="if (i<myFiles.length) this.form.files.value=myFiles[i++]">
</form>

©2018 Martin Webb