CSS:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <style type="text/css"> #flashingtext{ font-family: Trebuchet MS, sans-serif; font-size: 24px; color: silver; } #flashingtext2{ font-family: Trebuchet MS, sans-serif; font-size: 24px; color: silver; } #flashingtext3{ font-family: Trebuchet MS, sans-serif; font-size: 24px; color: silver; } </style> |
Javascript:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <script type="text/javascript"> function flashtext(ele,col) { var tmpColCheck = document.getElementById( ele ).style.color; if (tmpColCheck === 'silver') { document.getElementById( ele ).style.color = col; } else { document.getElementById( ele ).style.color = 'silver'; } } setInterval(function() { flashtext('flashingtext','red'); flashtext('flashingtext2','blue'); flashtext('flashingtext3','green'); }, 500 ); //set an interval timer up to repeat the function </script> |
HTML:
1 2 3 | <div id="flashingtext">JavaScript Flashing Text</div> <div id="flashingtext2">JavaScript Flashing Text</div> <div id="flashingtext3">JavaScript Flashing Text</div> |
http://jsfiddle.net/neuroflux/rXVUh/14/