Hi all,
I have the following code in my page but unfortunatelly it’s not working properly in IE6 and IE7.
HTML
[CODE]<div name=”cafe” id=”cafe1″ class=”elink”><a href=”#”>Cafe 1</a></div>
<div name=”cafe” id=”cafe2″ class=”elink”><a href=”#”>Cafe 2</a></div>
<div name=”cafe” id=”cafe3″ class=”elink”><a href=”#”>Cafe 3</a></div>
JAVASCRIPT
[CODE]function changeStyle(element){
[COLOR=”Red”]var e = document.getElementsByName(‘cafe’);
for(var i=0;i<e.length;i++){
e[i].style.backgroundColor = ‘#000000’;
}[/COLOR]
document.getElementById(element).style.backgroundColor = ‘#ffffff’;
}
Actually the lines colored in red don’t seem to work. The last line document.getElementById(element).style.backgroundColor = ‘#ffffff’; is ok.
Why is this happening? Can someone help please???