Recognizing the calling object


#1

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


#2

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

var index = pictures.indexOf(this);