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

Q393 How can I display every JPG image in a defined directory as a thumbprint image that when clicked brings up the image in full?

You are here: irt.org | FAQ | JavaScript | Image | Q393 [ previous next ]

You need an adaptation of the article Reading the contents of a directory:

The test.htm document defines two frames:

<html>
<head>
<script language="JavaScript"><!--
function reload_main() { window.main.location.href = "main.htm"; }
//--></script>
</head>

<frameset rows="*,1" onLoad="reload_main()">
<frame src="blank.htm" name="main">
<frame src="../images/" name="directory">
</frameset>

</html>

The contents of blank.htm:

<body></body>

The contents of main.htm:

<html>
<body>
<h1>Contents of directory</h1>

<script language="JavaScript"><!--
var links_length = parent.directory.window.document.links.length;
var link = "";
for (var i = 0; i < links_length ; i++) {
    link = parent.directory.window.document.links[i].href)
    if (link.indexOf('.jpg')) {
        document.write('<a href= "'+link+'"><img src="' + link + '" width="50" hight="50"><\/a>');
    }
}
//--></script>

</body>
</html>

Feedback on 'Q393 How can I display every JPG image in a defined directory as a thumbprint image that when clicked brings up the image in full?'

©2018 Martin Webb