-
display file contents
Hi,
I have a script that generates a photo album. The index is thumbnails. If you click on a thumbnail, it calls the full size image.
I want to add a comment bellow the image.
I want to get that comment from a .htm file that has the same name as the picture.jpg file.
So far I can write the .htm file name and create a link. But i have to click on that link to see the contents (comments) of the picture.
Is there a way of automatically displaying the contents of the comments file without needing to click on it?
thanks :)
-
what scripting language are you using?
you could setup an array with all the comments for the pictures and depending on which picture is shown call that part of the array.
-
This is the script:
See my goal bettween the 2 lines marked with
**********
**********
towards the bottom...
----------------------------------------------------------
writeln('document.mainimage.src = "" + currentPicture + "b.jpg";');
writeln('document.next.src = "' + rightArrowNormal + '";');
writeln('if (currentPicture == 1) {');
writeln('document.previous.src = "' + leftArrowGray + '"');
writeln('}}}');
writeln('function nextImage() {');
writeln('if (currentPicture != totalPictures) {');
writeln('currentPicture++');
writeln('document.mainimage.src = "" + currentPicture + "b.jpg"');
writeln('document.previous.src = "' + leftArrowNormal + '"');
writeln('if (totalPictures == currentPicture) {');
writeln('document.next.src = "' + rightArrowGray + '"');
writeln('}}}');
writeln('\/\/ \-\->');
writeln('<\/script>');
writeln('</head>');
writeln('<div align=center>');
writeln('<h1><font face="' + font + '">~ ' + albumName + ' ~</font></h1>');
writeln('<table width=100 border=0 cellspacing=0 cellpadding=3>');
writeln('<tr>');
writeln('<td bgcolor="#FFFFFF"><img src="' + i + 'b.jpg" name=mainimage></td>');
writeln('</tr>');
writeln('<tr valign=middle align=center>');
leftarrow = (i == 1) ? leftArrowGray : leftArrowNormal;
writeln('<td bgcolor="#FFFFFF"><center><a href="javascript:previousImage();"><img src="' + leftarrow + '" alt= "Previous" width=49 height=43 border=0 name=previous></a>');
writeln(' ');
writeln('<a href="javascript:window.location.href=window.location.href;"><img src="' + backArrow + '" width=49 height=43 border = "0"></a>');
writeln(' ');
rightarrow = (i == totalPictures) ? rightArrowGray : rightArrowNormal;
writeln('<a href="javascript:nextImage();"><img src="' + rightarrow + '" width=49 height=43 border=0 name=next></a><br>');
**********
**********
<!-- this goes bellow the image -->
writeln('<a href=' + currentPicture + 'b.htm>PIC' + '</a>');
// If I click on PIC, it displays the contents of the appropriate file. But i don't want to click on it. I would like to display the contents without clicking on it...
**********
**********
writeln('</center></td>');
writeln('</tr></table>');
writeln('</div>');
writeln('</body>');
writeln('</html>');
close();
}
}
-
not sure since I am not to keen on javascript, but you could do something like this.
Code:
myArray = new Array("Wind","Rain","Fire"); // starts with 0 as 0=Wind
writeln('myarray(i)'); //depending on what number you pic is.
that is if your pics are numbered. like I said, it could be a start since I ain't to keen on js.