Uncaught ReferenceError: spanArray is not defined
<p>I want to make a button to start the onclick to make the random numbers keep running,(use </p>

<ol>
<li>or 2. to call) but if I press it , the error message shows that "Uncaught </li>
</ol>

<p>ReferenceError: spanArray is not defined"  but above the number is still running, I cannot </p>

<p>understand where is the wrong place.</p>

<p>PS But if I use 3 it work normally.</p>

<p>Thx!</p>

<p>thx complete code I try  by 3 is <a href="http://jsfiddle.net/eVyjC/" rel="nofollow">http://jsfiddle.net/eVyjC/</a></p>

<pre><code>function computeRandom(){
// skip code: have used loop to create six spans already
var spanArray = document.getElementsByTagName("span");
//1.document.write("&lt;input type =  button  value = 'start' onclick = \"passKeepMove(value,spanArray) \"  name = button1&gt;");
//2.document.write("&lt;input type =  button  value = 'start' onclick =  \"setInterval(function(){keepMove(value,spanArray);}, 10) \"  name = button1&gt;");
//3.setInterval(function(){keepMove(value,spanArray);}, 10) ;
   }


function keepMove(val,sp){//call by pointer 

    var index = parseInt(Math.random()*43);//set a increment to avoid repeatition

    for( i = 0; i &lt; sp.length; i++){
    sp[i].innerHTML = val[i+index];
    }
}


function passKeepMove(v,s){
    setInterval(function(){keepMove(v, s);}, 10);
}
</code></pre>
