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" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<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>
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=''>email (spam protection)</a></noscript>

Open in new window

Who is Participating?
luigi382006Connect With a Mentor Author Commented:
I found a solution on another website, and my code looks like this:
<map name="Map" id="Map"><area shape="rect" coords="342,134,704,173" href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%69%6E%66%6F%40%72%6F%63%6B%79%70%6F%69%6E%74%62%69%6C%6C%70%61%79%2E%63%6F%6D"/>
Michel PlungjanIT ExpertCommented:
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>


<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
luigi382006Author Commented:
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.
Michel PlungjanIT ExpertCommented:
Not knowing the code you want to replace, I cannot help you
Michel PlungjanIT ExpertCommented:

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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.