I guess photo is an array. If that’s the case, try that:
var photo = document.getElementsByClassName(
"photo_class","img",document.getElementById("photo_wrap")
);
for (var i=0; i < photo.length; i++) {
photo[i].onclick = function(){
alert("Finaly!");
}
};