I have a set of images that I can click and when I click an image I want to change that images onclick event. The thing is each image has an number and when the user clicks on the image the image’s onclick has to fire to a function with its corresponding number.
I am able to change the onclick of an image when I click on it HOWEVER when I click on a second image my first images onclick event gets wiped.
[CODE]
//i has the value of the clicked image
//image_id is the number of the image
//This section of code is called when an image is clicked.
document.getElementById(‘article_image_’+i).onclick=function(){grab_image(image_id,’event’);document.getElementById(‘article_bodies’).removeChild(document.getElementById(‘article_image_’+i));}
I’m usually really good at debugging things like this but for some reason I can’t figure this ordeal out.
Help would be awesome!!