embedding javascript into links

okay, i know little about web development, so bare with me. I want to make a link like href="mailto:me@aqua-soft.org" but instead or mailto:me@aqua-soft.org, i want to insert a java script:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
user = "me";
site = "aqua-soft.org";
document.write('<a href="mailto:' + user + '@' + site + '">');
document.write('Email me!' + '</a>');
// End -->
</SCRIPT>

I read that this cuts down on spam ;), plus this is going to be in an image map so i think i have to use href and so i don't need the 'Email me!' part so you can cut that out. Any help appreciated

PS: i attempted to do it on my site already (see my signature) however, the Email me at the top is what i need help on, but the contact me at the bottom does work.

#402641

You can use php and do something like this

<?php

$user = "me";

$site = "aqua-soft.org";

echo "Email Me";

?>

you can see it here if you like

http://williamsden.com/email_test.php

*EDIT*

or you can do this

<?php

function createlink()

{

$user = "me";

$site = "aqua-soft.org";

echo "Email Me";

}

?>

<?php createlink(); ?>

both are examples are on the link above...

#402666

I don't think using php will reduce the risk of email spamming. The rendered page ends up with a normal mailto: link

Using javascript is a little bit too much for me, especially if you don't need it for anything else in your page. You can use a mail form without needing to give away your mail address.

Take a look:

http://www.mailmsg.com/guest-articles/prot...he-spambots.htm

#402680

Well, I'm not sure xanga supports php...I just wanted something simple to reduce spam. I don't think it supports mail form either :( i read somewhere about using html entity characters to hide your email? Anyone know anything about that?

#402813

In fact:

me@aqua-soft.org

Should send mail to "me@aqua-soft.org" ;)

[Edit: Aha, the browser is already parsing it! Check this out:

http://www.ilovejackdaniels.com/cheat-shee...es-cheat-sheet/

And I already wrote it up for you...http://nc.seph.ws/mail.txt

-NC

#402818

This article lists different ways of hiding email addresses using javascript and/or images - with pros and cons :)

#402866

thanks NC, today seph.ws is having server trouble again for me, but i'll try it at the library or...somewhere (internet's everywhere) ;)

also, thanks @dreadnaut, that article was really useful :) I decided to go with a mixture of Unicode and Hex Values instead of the Unicode method I was using yesterday. See:

<a href="../../unavailable.html">contact me</a>

(i just added dashes between so it wouldn't parse)

See here to convert them.

#403012