|
Below are two of numerous javascripts that will protect
an email address. Although the complete email address
is never actually in the text or markup, using one
of these scripts will result in an on-screen appearance
and a clickable link that is identical to the "old" way.
You will have to access the markup, either within
your web page editor or by opening your page in a plain
text editor (Notepad or WordPad - NOT Word). This may
look a little complicated at first, but you'll find
that once you've tried it, it is very straightforward.
The sample email address in these examples is: annoy.menot@boiseschools.org
Javascript example 1
If you want the email address to show on the
screen as a clickable link, in your markup
instead of this:
<a href="mailto:annoy.menot@boiseschools.org">annoy.menot@boiseschools.org</a>
Copy & paste the following where you want the
email to appear. Change annoy. and menot:
<script type="text/javascript">
<!--
emailE=('annoy.' + 'menot' + '@' + 'boise' + 'schools.org')
document.write('<a href="mailto:' + emailE
+ '">' + emailE + '</a>')
//-->
</script>
Note: when you edit the annoy.'
+ 'menot with your username it doesn't
matter how you split it up.
Javascript example 2
If you want text other than the email to show
on the screen as a clickable link, in your
markup instead of this:
<a href="mailto:annoy.menot@boiseschools.org">Email
Mrs. Menot</a>
Copy & paste the following where you want the
email to appear. The var address
= 'annoy.menot'; will need to be edited to reflect
your username and the document.write('Email
Mrs. Menot</a>'); to display the text
you want to appear in the browser:
<script type="text/javascript">
<!--
var first = 'ma';
var second = 'il';
var third = 'to:';
var address = 'annoy.menot';
var domain = 'boiseschools';
var ext = 'org';
document.write('<a href="');
document.write(first+second+third);
document.write(address);
document.write('@');
document.write(domain);
document.write('.');
document.write(ext);
document.write('">');
document.write('Email Mrs. Menot</a>');
// -->
</script>
The only drawback to using one of the javascript methods
is that there are visitors who have javascript disabled
(estimated to be between 1% and 5% of users). You can
be considerate of these visitors by placing the following
in the markup of your page in an appropriate location.
Feel free to change the text. It will only be visible
to those visitors with scripting disabled.
<NOSCRIPT>
Email addresses are protected by JavaScript.
Please enable JavaScript to see email addresses.
We apologize for the inconvenience.
< /NOSCRIPT>
|