title: How to repeat a function with Javascript
body: <p>This is the code that I've been working on, which makes the background color flicker colors. I'm wondering if anyone knows how to make this repeat so that the background continues to change colors on and on and on.</p>
  
  <pre><code>var a = new Array("ff", "ee", "dd", "cc", "bb", "aa", "99", "88", "77",
                    "66", "55", "44", "33", "22", "11", "00", "00", "11",
                    "22", "33", "44", "55", "66", "77", "88", "99", "AA",
                    "BB", "CC", "DD", "EE", "ff");
  
  x = 0;
  
  var b = new Array("ff", "ee", "dd", "cc", "bb", "aa", "99", "88", "77",
                    "66", "55", "44", "33", "22", "11", "00", "00", "11",
                    "22", "33", "44", "55", "66", "77", "88", "99", "AA",
                    "BB", "CC", "DD", "EE", "ff");
  
  x = 0;
  
  var c = new Array("00", "11", "22", "33", "44", "55", "66", "77", "88",
                    "99", "AA", "BB", "CC", "DD", "EE", "ff", "ff", "ee",
                    "dd", "cc", "bb", "aa", "99", "88", "77", "66", "55",
                    "44", "33", "22", "11", "00");
  
  x = 0;
  
  function bg_eff() {
    col_val = "#" + a[x] + b[x] + c[x];
    document.bgColor = col_val;
    x++;
    if (x == 32) {
      clearInterval(change_bg);
    }
  }
  change_bg = setInterval("bg_eff()", 50);
  </code></pre>