Jeff Cunningham wrote:
Patrick May wrote:
Here's a quick hack to display a blinking logo. Put this
JavaScript in the head element of your page:
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin var blinkInterval = 5 * 1000; // five seconds var blinkTime = 1 * 1000; // one second var logoFile = "hunchentoot-logo.png"; var blinkImageFiles = new Array ("hunchentoot-logo-blink-1.png", "hunchentoot-logo-blink-2.png", "hunchentoot-logo-blink-3.png", "hunchentoot-logo-blink-4.png");
I modified the javascript slightly so it would find the images on my server (in /images/) like this: But it doesn't work and I have no clue how Javascript works. Is there a way to debug it when you hit the page? maybe make it write out what the state is of the variables?
What I've pasted below came from View/Source, so that's what my cl-who code is generating for both the script and the subsequent image below on the page
<script language='javascript'> <!-- Begin var blinkInterval = 4 * 1000; // five seconds var blinkTime = 1 * 1000; // one second
var logoFile = "/images/hunchentoot-logo.png";
var blinkImageFiles = new Array ("/images/hunchentoot-logo-blink-1.png", "/images/hunchentoot-logo-blink-2.png", "/images/hunchentoot-logo-blink-3.png", "/images/hunchentoot-logo-blink-4.png"); var imageCount = blinkImageFiles.length;
function startBlink() { setInterval("blink()",blinkInterval); }
function blink() { var index = Math.floor(imageCount * Math.random()); var imageFile = blinkImageFiles[index]; document["HunchentootLogo"].src = imageFile;
setTimeout("unBlink()",blinkTime); }
function unBlink() { document["HunchentootLogo"].src = logoFile; } // End -->
</script>
<img src='/images/hunchentoot-logo.png' name='HunchentootLogo' alt='hunchentoot logo'>
Jeff