Sunday, May 19, 2024
4
rated 0 times [  10] [ 6]  / answers: 1 / hits: 15846  / 14 Years ago, sat, june 26, 2010, 12:00:00

I wrote some code that modifies the images on a webpage. Works with firefox and safari. But tryingto get it to work with Internet explorer has got me stumped. What is the equivalent of parentNode in explorer? Or how does one trick it into working?



images = document.getElementsByTagName('img')
parms = {};

for (a=0;a < images.length;a++){
parent = images[a].parentNode; // <-- What to substitute for explorer?
parms[a] = {};
parms[a].bigsrc=parent.getAttribute(href);
parms[a].w_o = images[a].width;
parms[a].h_o = images[a].height;
parms[a].IsBig = false;
parms[a].loaded = false;
images[a].border=0;
parent.setAttribute(href,javascript:MakeBig('+a+'));
}

More From » internet-explorer

 Answers
1

The problem is with the assignment of the parentNode to a var called parent. This seems to be a reserved word in IE that breaks the code. Change the var name and it should work.


[#96403] Tuesday, June 22, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
meliashelbief

Total Points: 179
Total Questions: 94
Total Answers: 116

Location: Romania
Member since Mon, Jun 6, 2022
2 Years ago
;