Eventually, I want the user to be able to click the node, be presented with a choice of images and fill the node with their choice. For now, however, I am just trying to test how to change the image placed in the node on table creation with a different image onclick. Is my logic fuzzy?
for (r = 0; r < howOften; r++) {
row = table.insertRow(-1);
for (c = 0; c < numDays; c++) {
col = row.insertCell(-1);
img=new Image();
img.src="../www/images/TEST.png";
col.appendChild(img);
img.onclick = function() {
image1= new Image();
image1.src="../www/images/TEST2.png";
img=image1;
};
}
};
document.getElementById('holdTable').appendChild(table);
};