PDA

View Full Version : Javascript email encryption


msweeney
03-02-2008, 10:15 PM
I've used Javascript in a Dreaweaver website I built to encrypt email address' and it worked beautifully! I can't seem to put that practice into use in Flash...can't seem to make sense of how to do it.

This is how I used the Javascript in Dreamweaver:
Inserted this code in the HEAD of the .html document
<script language="JavaScript1.2" src="inc/email.js"></script>

Called to the email.js in the email link like this:
<a href="javascript:;" class="bodystyleSmall" onMouseUp="sneakEmail('contact','mtmuseum','org')"><strong>Email Us</strong></a>

This is the code in the email.js:
// JavaScript Document
function sneakEmail(name,domain1,domain2){
var prefix ='mai'+'lto:';
var at='@';
var url= prefix+name+at+domain1+'.'+domain2;
document.location.href=eval('"'+url+'"');
window.status=url;
}

Is there a way to use this functionality in Flash? Essentially I want to use this same exact script and function in Flash. Is that possible? Currently in flash I link to emails like this: mailto:melcsweeney@aol.com

I'm much more of a designer than a coder so the more you can help in layman's terms that would be great.

Thank you!

landonRinek
03-06-2008, 02:54 AM
Just curious, but why would you want that functionality in flash, people can't scrap flash code so they'd never be able to scrape the email address anyway (which is why I presume you are doing this).