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

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?

irt.org | Knowledge Base | JavaScript | Object | Q1172 [ previous next ]

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?

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>

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.