Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1645 How can I make an image blink on and off a specified number of times?

irt.org | Knowledge Base | JavaScript | Image | Q1645 [ previous next ]

Q1645 How can I make an image blink on and off a specified number of times?

Try:

<script language="JavaScript"><!--
var onOrOff= 'on';
var rate = 500; // blinks every half second

function blinkImage() {
   if (onOrOff == 'on') onOrOff = 'off';
   document.images['myImage'].src = 'myimage' + onOrOff + '.gif';
   times--;
   if (times <= 0) return;
   setTimeout('blinkImage()',rate);
}

var times = 3;
setTimeout('blinkImage()',rate);
//--></script>

Feedback on 'Q1645 How can I make an image blink on and off a specified number of times?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.