- Colection of 65 PHP scripts for $4.29 each
Protect email address from spam bots
<script language="javascript">
function emailantispam(email1, email2, email3, email4){
emailE = email1 + email2 + '@' + email3 + email4;
document.write('<a href="mailto:' + emailE + '">' + emailE + '</a>')
};
</script>
Now, assume that your email address is TomRogers@yahoo.com. When you want to have a clickable email on your web pages you use this:
<a href="mailto:tomrogers@yahoo.com">tomrogers@yahoo.com</a>
However, the email address is listed as a plain text and every spam bot can easily find it out. Using the above JavaScript function you can still have a clickable email address on your web page but spam bots will not be able to find it out. All you need to use is:
<script language="javascript">emailantispam('tom','rogers','yah','oo.com');</script>
The emailantispam() function will build an email address using the 4 parameters you pass to it.
9 Comments to "Protect email address from spam bots"

Claudia Rogers / November 3, 2014 at 17:49 pm
Help me, please! The email address is not showing up where I tell it to display. These are the steps I took:
1 - I save the script below in a separate file called emailasp.js
<script language="javascript">
function emailantispam(email1, email2, email3, email4){
emailE = email1 + email2 + '@' + email3 + email4;
document.write('<a href="mailto:' + emailE + '">' + emailE + '</a>')
};
</script>
2 - In the head section of my page, I entered this:
<script type="text/javascript" src="emailasp.js"></script>
3 - Then, where I want the email address to show up, I entered the following:
<script language="javascript">emailantispam('crog','ers28','gma','il.com');</script>
What have I done wrong?
Thanks,
Claudia

Claudia Rogers / November 3, 2014 at 17:44 pm
Help me, please! The email address is not showing up where I tell it to display. These are the steps I took:
1 - I save the script below in a separate file called emailasp.js
<script language="javascript">
function emailantispam(email1, email2, email3, email4){
emailE = email1 + email2 + '@' + email3 + email4;
document.write('<a href="mailto:' + emailE + '">' + emailE + '</a>')
};
</script>[/js>
2 - In the head section of my page, I entered this:
<script type="text/javascript" src="emailasp.js"></script>
3 - Then, where I want the email address to show up, I entered the following:
<script language="javascript">emailantispam('crog','ers28','gma','il.com');</script>
What have I done wrong?
Thanks,
Claudia

schmitt / August 4, 2008 at 14:12 pm
Dear sir,
I'm buying a lot of script now, but I have tested your forms, but when I send the form data with email as well = mail@hotmail without point and extension, the system not do the message to ask for validate email. could you explain me how to complete my script to do it?


alice / August 17, 2007 at 01:22 am
on my contact i added the above but and placed "@" to further confuse spam. on the second java script. but on the site it has both addresses. what do i need to do to change or correct. and i wanted an' info@smartitag.com as well.
also is my top and bottom java in the right place. thankyou for your assistance

Kevin / February 5, 2007 at 07:32 am
Total newbie. Where do I put each script reference in the webpage? The function script goes where? Can this script be saved as a separate js file and referenced to it with the secondary script?
----------------------
Veselin: JavaScript function can be in separate file but you need to include the file in the head tag of your web pages. Then on the places where you want email address to appear you can put the function reference.

nirz / December 22, 2006 at 02:06 am
is it possible for you to give a working example of this. I am not sure where the codes go and what is my address is, say, "info@mydomainname.com" as opposed to yahoo.com?
Thank you.
--------------------------------
Veselin Stoilov:
you can use <br />
<script language="javascript">emailantispam('in','fo','mydomain','name.com');</script>
--------------------------------
nirz: oops! The email address is now showing up at the top left hand side of the contact.html page (where the contact form is). Did I put the Javascript line in the wrong place?
--------------------------------
Veselin: most probably YES :) it needs to be where you want the email to appear