I have an array of images that populate the page. I want the user to click on an image and a bigger version of the same image is supposed to appear in a popup-window coded as such: onclick=”window.open(‘
This works for the first image but since I have them grouped in arrays as cover, coverone and covertwo, the code does not work for each image (under the cover array and under coverone array and so on). Anyway to go about it?
here is the js code:
var str = “<table>”;
var imgFolder = “images/”;
var cover = new Array();
cover[0] = “kitchenHouseSale.jpg”;
cover[1] = “eatLive.jpg”;
cover[2] = “loveAnthonySale.jpg”;
var coverone = new Array();
coverone[0] = “casualVacancy.jpg”;
coverone[1] = “quiet.jpg”;
coverone[2] = “whirlAway.jpg”;
var covertwo = new Array();
covertwo[0] = “everyLastSale.jpg”;
covertwo[1] = “neilYoung.jpg”;
covertwo[2] = “soupSisters.jpg”;
for (var i = 0; i < cover.length; i++)
{
str += “<tr><td colspan=’2′><h2>” + category[i] + “</h2></td></tr>”;
str += “<tr><td class=’basket’><img src='” + imgFolder + cover[i] + “‘ width=’108′ height=’159’ onclick=”open_win()”>
}
str += “</table>”;
var elem = document.getElementById(“table”);
elem.innerHTML = str;
Any help is appreciated. Thanks!