Problem with getElementsById
Posted on 2004-03-23
var current = 1;
var offClass = new Array('about','products','services','contact');
for(i=0; i < 4; i++)
if(_itemRef != i)
document.getElementById(i).className = offClass[i];
What I want it to do is change the class of <div id="1...4"></div> unless the div id is the same as _itemRef, however there seems to be a problem with the document.getElementById(i).className = offClass[i]; line as it says it has no properties. How do I access the divs with id 1,2,3,4 using a for loop?