Link to home
Start Free TrialLog in
Avatar of luigi382006
luigi382006

asked on

How to embed antispam script

Hi I'm using an online javascript generator to obfuscate an email address; but I need to use that on a hotspot map to trigger the action. My problem is that I don't know how to "embed" the script into the href tag from the hotspot, or there is another way to do it?
The script states that needs to be inserted into the body section of the page, and from there just runs great, but is not really how I need to use it.
This is the code from the html document...
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p align="center"><img src="logo.jpg" alt="RockyPointBillPay" width="750" height="417" border="0" usemap="#Map"/>
<map name="Map" id="Map"><area shape="rect" coords="342,134,704,173" href="" /></map></p>
</body>
</html>
 
This is the script to obfuscate the email address...
 
<script type='text/javascript'><!--
var v2="52AAGQPM4GR43NUCKENMDVKKVY";var v7=unescape("%5C%5C%27.%07%23%3F._%3E%22%5BZ%20%21%21%22%29%22%3D%25/e%2894");var v5=v2.length;var v1="";for(var v4=0;v4<v5;v4++){v1+=String.fromCharCode(v2.charCodeAt(v4)^v7.charCodeAt(v4));}document.write('<a href="javascript:void(0)" onclick="window.location=\'mail\u0074o\u003a'+v1+'?subject='+'\'">'+'email<\/a>');
//--></script><noscript><a href='http://w2.syronex.com/jmr/safemailto/#noscript'>email (spam protection)</a></noscript>

Open in new window

Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Just remove
document.write('<a href="javascript:void(0)" onclick="window.location=\'mail\u0074o\u003a'+v1+'?subject='+'\'">'+'email<\/a>');

and put

<a href="#" onClick="this.href= 'mail\u0074o\u003a'+v1+'?subject=Email%20from%20my%20site';">email</a>

or

<area href="#" onClick="this.href= 'mail\u0074o\u003a'+v1+'?subject=Email%20from%20my%20site';" />

where you have your hotspot

This link must be after the code that generates the link
Avatar of luigi382006
luigi382006

ASKER

Thank you for your response, but this is not working, or I don't know how to implement your advice.
Right now only the html code is on the page, the script is generated online and I only copy and paste that to the page, but like I said, works like a text link, and I need that to work on a invisible hotspot that is covering the real email address that is an image.
Not knowing the code you want to replace, I cannot help you
ASKER CERTIFIED SOLUTION
Avatar of luigi382006
luigi382006

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok...

My version would have been

<map name="Map" id="Map"><area shape="rect" coords="342,134,704,173" href="#"
onClick="this.href='mailto'+':'+'rockypointbillpay'+'.'+'com'" />

but yours works too