I'm trying to figure out why my code isn't functioning properly. Is there a mistake I'm not seeing?
window.onload = function randomizeColor() {
var links = document.getElementsByTagName('a');
var colors = new Array("green","red","blue");
var randomColor = colors[Math.floor(colors.length * Math.random())];
for (var i = 0; i < links.length; i++) {
links[i].style.color = randomColor;
}
}