How do I assign a random colour to links?
<p>Just wondering why my code isn't working. Am I doing this completely wrong?</p>

<pre><code>window.onload = function random() {
    var links = document.getElementsByTagName('a');
    var colours = new Array("green","red","blue");
    var randomColour = colours[Math.floor(colours.length * Math.random())];
    for (a = 0; a &lt; links.length; a++) {
        links[a].style.color = 'randomColour';
    }
}
</code></pre>
