robertsclark
IS-IT--Management
Hi!
Firstly, I'm not a JavaScript programmer, so hence the request for help!
I have several web pages with multiple anchor mailto links. I am concerned that these may be 'harvested' by spammers, so want to create a level of protection.
I have managed to find a piece of javascript that I can use to 'hide' e-mail addressed from being harvested:
<script type="text/javascript">
<!--
// To stop e-mail addressing being harvested
gcmem=('yourname@domain.root')
document.write('<a href="mailto:'+gcmem+'&subject=website referral"> <img src="email.gif" alt=""> '+gcmem+'</a>')
//-->
</script>
<noscript>
<em>E-mail address protected by JavaScript</em>
</noscript>
What I would like to be able to do is to turn this into a function and then call it with parameters
eg:
instead of
<a href="mailto:yourname@domain.com">
I would like to do
functioncall(yourname,domain,com)
Is this possible?
How would it need to be changed so that I can pass the subject parameter as an option?
Many thanks!
Robert
Firstly, I'm not a JavaScript programmer, so hence the request for help!
I have several web pages with multiple anchor mailto links. I am concerned that these may be 'harvested' by spammers, so want to create a level of protection.
I have managed to find a piece of javascript that I can use to 'hide' e-mail addressed from being harvested:
<script type="text/javascript">
<!--
// To stop e-mail addressing being harvested
gcmem=('yourname@domain.root')
document.write('<a href="mailto:'+gcmem+'&subject=website referral"> <img src="email.gif" alt=""> '+gcmem+'</a>')
//-->
</script>
<noscript>
<em>E-mail address protected by JavaScript</em>
</noscript>
What I would like to be able to do is to turn this into a function and then call it with parameters
eg:
instead of
<a href="mailto:yourname@domain.com">
I would like to do
functioncall(yourname,domain,com)
Is this possible?
How would it need to be changed so that I can pass the subject parameter as an option?
Many thanks!
Robert