blog.robin-ann.net

My BLOGS: Curriculum Vitae | blog.robin-ann.com | blog.nH
Webpages in Progress: bally duff | nH.org | nH.com
Tools: DNS | domains | di.fm | ebay | csscreator | Site Experts

this iz RA'z FuN rezidense

blog.robin-ann.net is an extension of robin-ann.com and is proclaimed as the site for fun, quirky, nonsensical, cool, crazy, daffy, dizzy, flaky, foolish, for grins, freaked out, freaky, gagged up, goofball, idiotic, illogical, inane, incongruous, irrational, jokey, joshing, kooky, laughable, looney, ludicrous, monkey, nutty, preposterous, sappy, screwy, senseless, sensational, shtick, silly, stupid, tomfool, unusual, unreasonable and wacky posts!


Tuesday, February 21, 2006

ROT-13 Javascript Spam Defender

From the Rose Garden emerges a nice javascript to confuse spam-bots. This ROT-13 code will defend against most of those evil buggers from harvesting your email address.

<!-- Script to hide email address using ROT-13 -->
<script language='JavaScript'>
<!--
function rot13 (string) {
  var aCode = 'a'.charCodeAt();
  var zCode = 'z'.charCodeAt();
  var ACode = 'A'.charCodeAt();
  var ZCode = 'Z'.charCodeAt();
  var result = '';
  for (var c = 0; c < string.length; c++) {
    var charCode = string.charCodeAt(c);
    if (charCode >= aCode && charCode <= zCode)
      charCode = aCode + (charCode - aCode + 13) % 26;
    else if (charCode >= ACode && charCode <= ZCode)
      charCode = ACode + (charCode - ACode + 13) % 26;
    result += String.fromCharCode(charCode);
  }
  return result;
}
// -->
</script>

<p>Here is my email address: <script language="JavaScript">
<!--
var name="ebova-naa@ebova-naa.pbz";
document.write('<a href=\"mailto:' + rot13(name) + '\">');
document.write(rot13(name) + '<\/a\>');
// -->
</script></p>
<!-- End of example code -->

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home