Click to See Complete Forum and Search --> : .className not working in IE


gaurav1146
01-24-2006, 10:24 AM
I am using a javascript function to show some hidden elements on a page. Following is the piece of javascript code.

var itemArray = document.getElementsByName('hiddenItem');

for(i=0;i<itemArray.length;i++){
itemArray[i].className='pageSummary_cell';
}

The hiddenItem have a class where their display is set to none. When I set the className to pageSummary_cell, the items are displayed in firefox but not in IE. can anybody suggest a solution to it?

Thanks in advance
gaurav

JPnyc
01-24-2006, 10:37 AM
Have a look at this

function hideSpans() {
var Spans = document.getElementsByTagName('span');
for(var i=0; i < Spans.length; i++) {

if(Spans[i].className=='someClass') {

Spans[i].className='pageSummary_cell';
}}}

Of course you can change the tag name to whatever you need it to be.