Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combiing two javascripts...

Status
Not open for further replies.

Extras

Technical User
Nov 16, 2001
232
US
I have one javascript that I use to hide email addresses from spammers, and another I use to create roll-overs of images. I was wondering how to combine them so I can hide the email addres that is referenced through an envelope icon that rolls over.

javascript #1 for hiding the email address (MyHandle@MyDomain.com) :

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
document.write(&quot;<a href='mailto:&quot;);
document.write(&quot;MyHandle&quot;);
document.write(&quot;\100&quot;);
document.write(&quot;MyDomain.com&quot;);
document.write(&quot;'>&quot;);
document.write(&quot;Email&quot;); document.write(&quot;</a>&quot;);
</script>


The javascript #2 I use for a rollover icon (I am not including the one in the head of the document -just the code where it is displayed:

<a href=&quot;javascript:;&quot; onMouseOut=&quot;MM_swapImgRestore()&quot; onMouseOver=&quot;MM_swapImage('Email','','Images/Nav/email2.gif',1)&quot;><img src=&quot;Images/Nav/email1.gif&quot; width=&quot;20&quot; height=&quot;15&quot; name=&quot;Email&quot; border=&quot;0&quot;></a>


I would like to nest Javascript #2 within javascript #1

Thanks for all your help!




 
It is pretty hard to stop this 100%, as teh address could be seen:

1. by the status bar output
2. by right clicking the link and copying the link to another app
3. by viewing the source of the page.

You can get rid of the first 2 by:

(1) changing the status bar during the rollover

&

(2) removing the right click ability

unfortunately there is no way to keep them from viewing the source. Nor can you keep them from clicking the link and having it open in a mail program to gain the mail address anyway.

AntSpamming code was to keep &quot;spiders&quot; from browsing a website and pulling email addresses it found to use for spam (or other nefarious acts) ... it wasn't designed to keep actual visitors from seeing information.

If I turn off JS in my browser I can see everything anyway.

 
Sorry I should have clarified - the code is only to prevent/make it difficult for spiders from harvesting addresses - it is okay for web users to see the addresses...

So, how can I &quot;nest&quot; javascript #1 within the code of #2 that will allow me to have a rollover icon and also prevent spiders from crawling the email addresses?

TIA!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top