Display image in a div like image gallery
<p>I want to display a selected image from table rows inside a div. i am using a for loop to populate the table but now i find it hard to display the selected image inside the div as the id's are dynamic. Here is my for loop</p>

<pre><code>for (i=1; i &lt; my_image.length-1; i++) {

            if (i%3==0) {

                str += "&lt;td&gt;&lt;a 

href='"+my_image[i]+"'onclick='displayimg()'id=/image"+my_image[i] +"/"+" class='popup-

open'&gt;&lt;img src='"+my_image[i]+"'"+

                "width='80' height='65'&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;";

            }

            else {

                str+= "&lt;td&gt;&lt;a href='"+my_image[i]+"'class='popup-open'&gt;&lt;img src=' 

"+my_image[i]+

"' width='80' height='65'&gt;&lt;/a&gt;&lt;/td&gt;";

            }
        }
</code></pre>

<p>how can i display these image in a div content on user click.</p>
