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 http://jaakkospage.comyr.com/ ?
If you want to contact, please send me an
<script type="text/javascript">
// 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 = "[email protected]?fjHsBQi=LpJY 5m0L iVB cBHxpUB"
key = "r3uREWBMXSnIezJANyZHi2Dq8btKkGv7PQFd4VTc51xh9wf0pCLYsoaUmljO6g"
shift=coded.length
link=""
for (i=0; i<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("<a href='mailto:"+link+"'>e-mail.</a>")
}
//-->
</script><noscript>Sorry, you need Javascript on to email me.</noscript>
Some of the validation errors:
Line 42, Column 27: character ";" not allowed in attribute specification list
for (i=0; i<coded.length; i++) {Line 42, Column 27: element "coded.length" undefined
for (i=0; i<coded.length; i++) {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:
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).