Results tagged “javascript”

I know this is probably done a million times elsewhere, but I thought this approach was pretty neat. At work, we worry about spam harvesters collecting our addresses, so we want to hide them.

So today at work, I whipped this up pretty quickly, using Google's AJAX API Library + Prototype.

<html>
<head><title>Dynamic/Obfuscated Email Link Example</title></head>
<body>
<div>
<span class="add_email_link" id="jason">This should become an email link to me!</span>
</div>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
    google.load("prototype", "1.6.0.3");
    google.setOnLoadCallback( function() {
        // gather all .add_email_link's and add mailto links around their children
        $$('span.add_email_link').each( function( span ) {
            span.update( '<a href="mailto:' + span.id + '@example.com">' +
                span.innerHTML + '</a>' );
        } );
    } );
</script>
</body>
</html>

So ... guess this doesn't have anything to do w/ Perl, per se, but couldn't resist sharing. What about you? What technique do you use?

Peace,

Jason

Perl & JavaScript

While I didn't promise frequent posts, I want to keep the chatter alive on the site. Unfortunately, this post has very little to do w/ Perl, but it's not an anti-Perl post, either. I'm furiously at work on a paper for the Ajax in Action conference next week, where I'll be presenting selection criteria for JavaScript frameworks/libraries.

When you're a Perl Web developer, there comes a time when you have to start developing parts of your web application for the client. Unfortunately, PerlScript never really took off and so we walk down the road to JavaScript. Thus, a dichotomy is formed for our development work. Libraries make that easy, safe and reliable ... and not to mention, save us a ton of work. This keeps the percentage of your head attuned to things Perl at a majority, too.

When I return, I'll share slides and more thoughts. ;)

Peace,

Jason
1

Authors

  • Dave Cross
  • Luis Motta Campos
  • Jason Purdy
  • Michael Peters
  • Steve Marvell
Close