Re: Self generated html pages with javascript
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Self generated html pages with javascript

From: alu <none@none.com>
Date: Fri Jul 15 2005 - 15:30:46 CEST

<lepa71@gmail.com> wrote
> Hi all
>
> I'm trying to solve a problem. I want to create a html page with
> javascript inside to generate a table of images from a folder on local
> drive. The number of images is unknown upfront. It's kind of a Photo CD
> application.
>
> Is this possible?
>
> Thanks

If the images are named sequentially e.g, 1.jpg to 60.jpg
there should be no difficulty in generating this with a simple
loop. Quick example for one row:

___________________________

<table border="1">
<tr>

<script type="text/javascript">
for (var i = 1; i < 10; i++) {
document.write('<td><img src="images/'+i+'.jpg"
onerror="this.src=\'images/spacer.gif\'"></td>')
}
</script>

</tr>
</table>
__________________________

-alu
Received on Tue Oct 18 02:56:27 2005