the code below cannot run properly on Google Chrome :
var e,
divStyle = {
backgroundColor: "rgba(153, 153, 153, 0.29)",
postion: "fixed",
top: 0,
left: 0,
width: "100%",
height: "100%"
},
imgStyle = {
maxWidth: "700px",
maxHeight: "700px"
},
imgDivs = document.getElementsByClassName("resumeAttchImg"),
listener = function () {
var style,
img = this.firstElementChild;
for (style in divStyle)
this.style[style] = divStyle[style];
for (style in imgStyle)
img.style[style] = imgStyle[style];
};
for (e in imgDivs) {
imgDivs[e].addEventListener("click", listener);
console.log(imgDivs[e].addEventListener);
}
Chrome threw an exception:
"Uncaught TypeError: imgDivs[e].addEventListener is not a function"
how ever, console.log(imgDivs[e].addEventListener)
do print a function definition like :
function test.html:182 addEventListener() { [native code] }
how to fix this?