Click to See Complete Forum and Search --> : Email Robot Script


spuddy
12-22-2002, 05:25 AM
Can anyone help me with this little one?
I have been using the code below within my web page but am trying to incorporate an image into the script so the user just clicks the image to send me an Email. Currently the script displays my email address as script.
Regards


<script language="JavaScript"><!--
// hide script
var sb_domain = "doncaster40.freeserve.co.uk"
var sb_user = "alan_grey"
var sb_recipient = sb_user + "@" + sb_domain
var sb_url = "mailto:" + sb_recipient
document.write(sb_recipient.link(sb_url));
// --></script>

swon
12-22-2002, 05:55 AM
Try this:

<script language="JavaScript"><!--
// hide script
var sb_domain = "doncaster40.freeserve.co.uk"
var sb_user = "alan_grey"
var sb_recipient = sb_user + "@" + sb_domain
var sb_url = "mailto:" + sb_recipient
window.location.href= sb_url + sb_recipient;
// --></script>

You've used the document.write, that write it on your page.

spuddy
12-22-2002, 06:14 AM
Hi Swon,
Thanks for your reply.
I have tried this script but when I now go to my page, a new email reply is automatically created.
What I would like the script to do is when an image is clicked the user is taken to the new message page to send me an email but using the script listed in the previous post.

The image I am trying to incorporate is located at http://www.doncaster40.freeserve.co.uk/email7.gif width=60 height=30 ALT="E-mail"

ShrineDesigns
12-22-2002, 06:22 AM
<script language="JavaScript">
<!--
var sb_domain = "doncaster40.freeserve.co.uk"
var sb_user = "alan_grey"
var sb_recipient = sb_user + "@" + sb_domain
var sb_url = "mailto:" + sb_recipient
document.write('<a href=\"sb_url + sb_recipient\"><img src=\"email7.gif\" width=60 height=30 alt=\"E-mail\"><\/a>');
// -->
</script>

spuddy
12-28-2002, 05:20 AM
Hi ShrineDesigns,
Thank you for your reply to my problem. I have inserted this script into my page, however when I run the script it takes me to an error page - This page Cannot be found -
It seems as if it is trying to take me to my web page rather than opening up a new message Email box.

I have inserted the code into the following address for your reference.

www.doncaster40.freeserve.co.uk/aaaaaa.html

Looking forward to your or anyones help.
Regards

swon
12-28-2002, 10:22 AM
Hi Spuddy,

I've put it into a function:

<script language="JavaScript"><!--
// hide script
function mailer()
{
var sb_domain = "doncaster40.freeserve.co.uk"
var sb_user = "alan_grey"
var sb_recipient = sb_user + "@" + sb_domain
var sb_url = "mailto:" + sb_recipient
window.location.href= sb_url + sb_recipient;
}
// -->
</script>

<a href="#" onClick="mailer()">email me</a>