The following script works perfectly, but when I try it with GetElementsByTagName
it fails. An ID
can only be used once and I want to use it for ('a', h1, h2
).
Thoughts, ideas or solutions are welcome.
window.setInterval(function(){
var t = document.getElementById('test');
var z = 'rgb('+ (Math.floor(Math.random() * 184)) + ','
+ (Math.floor(Math.random() * 102)) + ','
+ (Math.floor(Math.random() * 184)) + ')';
t.style.color = z
}, 1000);