In any case, the code is horribly over-complex and could and should be simplified:
Code:
<html>
<body>
<div id="agent1">blah</div>
<div id="agent2">bleh</div>
<script type="text/javascript">
(
function()
{
function blink( )
{
for ( var b = 1; b < 9999; ++b )
{
var div = document.getElementById("agent" + b )
if ( div == null ) return;
div.style.visibility = ( div.style.visibility == "hidden" ) ? "visible" : "hidden";
}
}
setInterval( blink, 3000 );
}
)();
</script>
</body>
</html>
Now it works with any number of "agentNN" divs (or spans or whatever) *and* with any initial visibility per agentNN (provided the style is code inline).
That is, you could add
Code:
<span id="agent3" style="visibility: hidden;">wowser!</span>
And it would autmatically be blinked, as well, but in opposition to the blinks for agent1 and agent2, as given.