I have a javascript function displayImages() to display all the images in a directory. I am calling this function inside a DIV "photo_gallery" so that the images display in that DIV only (after page loads)
However I also needs to display the image gallery dynamically and for which I have to call this function from outside DIV i:e from other function inside my js file.
<div id="photo_gallery" style="display:none">
<ul>
<script>displayImages();</script>
</ul>
</div>
Can someone please advise
Below is my function :
Note : (here images is an array of images)
function displayImages() {
for (i=0;i<images.length;i++) {
document.write("<a href='#pop1'>");
document.write("<img onclick='currentimage("" + images[i] + "")' class='photo' src='" + images[i] + "' width='160' height='120'/>");
document.write("</a>");
}
}