[How I cloak email addresses coming from a database] Contact Me
Instead of having to do a form-based solution using 'id' numbers to hide email addresses that reside in your database - this solution provides an implementation that does a "mailto:" link with cloaking from within TBS using an 'ondata' PHP function.
A simple link to a form looks like this:
<a href="/contact.html?id=726" title="Contact Me!">Contact Me!</a>
We're not going to get rid of the current href, so that even if they don't have
javascript or an email client on their system, they can still contact you using a contact
form (at "/contact.html").
I migrated a cloaking scipt to work as a TBS 'ondata' function - it adds onmouseover and onfocus handlers to change the actual address to the
'real' email address when they interact with it. The output looks like:
<a href="/contact/" title="Contact Me!"
onmouseover="javascript:this.href=mailMe('example%23com?subject=TBS cloaking funct','me');"
onfocus="javascript:this.href=mailMe('example%23com?subject=TBS cloaking funct','me');"
>Contact Me!</a>
Don't forget to put the little slug of javascript in the top of your template html file.
|