Saturday, November 6, 2010

Lesson 3: E(gg)mail Scramble

Unfortunately, Blogger won't let me add the code I need to show you that I can now scramble emails. So I'll have to tell you how I did it:

I used two files. I took and modified the escrambler.js file from my Creating Web Pages for Dummies book. It was supposed to accommodate emails that don't end in .com, but it wasn't working so I edited it. Now it can only scramble .com addresses, but that's fine for me. I created javalab.html as a dummy web page, which is what you should have been able to see in this post space. Instead, I'll paste it below so you can see. (For all you non-HTML people, I've color-coded the javascript elements as purple.)

<head><script src='escrambler.js' type='text/javascript'/>
<title>Jenn's JavaLab</title>
</head>
<body>
Below I have scrambled my email address with standard and maximum protection, respectively. The real scramble is in the links, but I've shown you what they look like too (spaces added for clarity).

<a href="mailto:Horsemorpher_at_aol.com">Horsemorpher _at_ aol.com</a>

<a href="mailto:Horsemorpher!a!aol!d!!ds!">Horsemorpher !a! aol !d! !ds!</a>

<script type='text/javascript'>
unscramble( 0 );
unscramble( 1 );
</script>
</body>

I tested the links out, and they really work! Cool java beans! Spammers got nothing on me now!

No comments:

Post a Comment