JavaScript spam filter
<p>I tried to make a spam filter for my e-mail by JavaScript. Unfortunately the code won't be passed by a validator. Can anyone say what are the mistakes in my code in <a href="http://jaakkospage.comyr.com/" rel="nofollow">http://jaakkospage.comyr.com/</a> ?</p>

<pre><code>If you want to contact, please send me an
&lt;script type="text/javascript"&gt;
// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
{ coded = "sppDD0.s.fBxxpYp@ULpJY.Q0L?fjHsBQi=LpJY 5m0L iVB cBHxpUB"
  key = "r3uREWBMXSnIezJANyZHi2Dq8btKkGv7PQFd4VTc51xh9wf0pCLYsoaUmljO6g"
  shift=coded.length
  link=""
  for (i=0; i&lt;coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else {     
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
document.write("&lt;a href='mailto:"+link+"'&gt;e-mail.&lt;/a&gt;")
}
//--&gt;
&lt;/script&gt;&lt;noscript&gt;Sorry, you need Javascript on to email me.&lt;/noscript&gt;
</code></pre>

<p>Some of the <a href="http://validator.w3.org/check?uri=http%3A%2F%2Fjaakkospage.comyr.com%2F&amp;charset=%28detect+automatically%29&amp;doctype=Inline&amp;group=0" rel="nofollow">validation errors</a>:</p>

<blockquote>
  <p>Line 42, Column 27: character ";" not
  allowed in attribute specification
  list</p>

<pre><code>for (i=0; i&lt;coded.length; i++) {
</code></pre>
  
  <p>Line 42, Column 27: element
  "coded.length" undefined</p>

<pre><code>for (i=0; i&lt;coded.length; i++) {
</code></pre>
  
  <p>You have used the element named
  above in your document, but the
  document type you are using does not
  define an element of that name. This
  error is often caused by:</p>
  
  <p>incorrect use of the "Strict" document
  type with a document that uses frames
  (e.g. you must use the "Frameset"
  document type to get the ""
  element), by using vendor proprietary
  extensions such as "" or
  "" (this is usually fixed by
  using CSS to achieve the desired
  effect instead). by using upper-case
  tags in XHTML (in XHTML attributes and
  elements must be all lower-case).</p>
</blockquote>
