Do you *MEAN* turn off? In that case, instead of just changing the 0 to "" wouldn't you want to change the div's style to "display: none;"??
BUt anyway:
Code:
var divs = document.getElementsByTagname("div");
for ( var d = 0; d < divs.length; ++d )
{
var div = divs[d];
if ( div.innerHTML == "0" )
{
div.innerHTML = "";
// or
div.style.display = "none";
}
}
Note that this will process *ALL* the <div>s on your page.
If possible try to somehow "contain" them.
Example:
Code:
<div id="onlyLookHere">
<div>8</div>
<div>5</div>
<div>0</div>
<div>6</div>
<div>0</div>
<div>0</div>
<div>1</div>
</div>
and then do:
Code:
var divs = document.getElementById("onlyLookHere").getElementsByTagname("div");
for ( var d = 0; d < divs.length; ++d )
{
var div = divs[d];
if ( div.innerHTML == "0" )
{
div.innerHTML = "";
// or
div.style.display = "none";
}
}