Why is this text effect not working?
<p>I am trying to modify the script from <a href="http://i-code.co.uk/javascript/decryptingtext.php" rel="nofollow">here</a> to work on more then one span.</p>

<p>I have tried this, but it seems to overwrite both spans with the same text.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script&gt;
var got;
var chars;

function change(decSpan,encSpan)
{
   var randstring = "";
   var rslength = chars.length - got.length;

   var decrypted = document.getElementById(decSpan);
   var encrypted = document.getElementById(encSpan);

   for(var x=0;x&lt;rslength;x++)
   {
       i = Math.floor(Math.random() * chars.length);
       randstring += chars.charAt(i);
   }

   if(randstring.charAt(0) == chars.charAt(got.length))
   {
      got += randstring.charAt(0);
      decrypted.innerHTML = got;
   }
   else
   {
      encrypted.innerHTML = randstring;
   }

   if(chars.length &gt; got.length)
   {
  setTimeout("change('"+decSpan+"','"+encSpan+"')", 10);
   }
   else
   {
      encrypted.innerHTML = "";
   }
}
function startdecrypt()
{
   var decodeSpans = ["decoded","decoded2"];
   var encodeSpans = ["encoded","encoded2"];
   for(var z in decodeSpans) 
   {
decSpan = decodeSpans[z];
encSpan = encodeSpans[z];
    var decrypted = document.getElementById(decSpan);
    var encrypted = document.getElementById(encSpan);

    chars = decrypted.innerHTML;
    decrypted.innerHTML = "";
    got = "";
    setTimeout("change('"+decSpan+"','"+encSpan+"')", 10);
   }
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body bgcolor="#FFFFFF" text="#000000"&gt;
&lt;input type="button" value="go" onClick="javascript:startdecrypt()"&gt;&lt;br&gt;
&lt;span id="decoded"&gt;Test1&lt;/span&gt;&lt;span id="encoded"&gt;&lt;/span&gt;&lt;br&gt;
&lt;span id="decoded2"&gt;Test2&lt;/span&gt;&lt;span id="encoded2"&gt;&lt;/span&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
