1. IE gives me an out of memory error on line 13.
2. If I uncomment the doc.write command, it shows that the function appears to be looping, but obviously not once every 3 seconds.
3. I've tried using setTimeout with single and double quotes, and without any at all, around the called function.
If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
* The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
* The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
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).
It's been a while since I coded in JavaScript. Thank you for reminding me about the function().
Quote:
Originally Posted by WolfShade
All I'm going to say is that <blink> was deprecated for a reason.
Ah, the 90's ... full of <blink>, glitz, and badly formatted websites! Yep, I know blink is depreciated, but this is for a work project and parts of it need to blink when certain time thresholds have been reached.
Quote:
Originally Posted by Old Pedant
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).