views:

26

answers:

0

I'm iterating through an array of strings (ids) and passing each element of the array to a function which either hides that element by id or shows it.

for(var tag = 0; tag < idtagArray.length; tag++){UpdateImage( idtagArray[tag], xmlhttp.responseText);}

And the UpdateImage function:

function UpdateImage( usediv, data )
{
    if( data == null || data.length <= 0 ) {
        update_value.innerText = 0;
        return;
    }
 // [A5:1][A6:1][A7:1][A8:1]
    var start       = data.indexOf( "[" + usediv + ":" ) + 2 + usediv.length ;
    var end         = data.indexOf( "]", start );
    var data_value  = data.slice( start , end ) ;

 if( data_value > 0 )
 {
  document.getElementById(usediv).style.display = "";
 }
 else
 {
  document.getElementById(String(usediv)).style.display = "none";
 }
}

The error is with getElementById - Object Needed. This only occurs on IE8; Mozilla and Chrome are fine. I even tried casting the parameter into a string with no success.