Recognizing the calling object


Hi, I have an array of images obtained in this way:
"var pictures = document.getElementsByTagName(“img”).
Besides, I have a function associated with each one of them called by “onclick”, but I must know the index of calling image inside the function


Assuming pictures is in scope, it should be as simple as

var index = pictures.indexOf(this);