Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- var acolors = ["crimson", "aqua", "lawngreen", "coral", "darkblue", "violet", "grey", "yellow", "blueviolet"];
- document.getElementById("output").style.backgroundColor="crimson";
- function color() {
- acolors = shuffle(acolors);
- for (var i=0; i<acolors.length; i++) {
- var id = "td"+(i+1);
- var kleur = acolors[i];
- document.getElementById(id).style.backgroundColor= kleur
- }
- document.getElementById("output").style.backgroundColor="crimson";
- }
- function shuffle(arr) {
- for (var j, x, i = arr.length; i; j = Math.floor(Math.random() *i ), x = arr[--i], arr[i] = arr[j], arr[j] = x);
- return arr;
- }
- function setTimer() {
- setInterval(color, 2000);
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement