How do I establish (email button)

They have: 2 posts

Joined: Apr 2007

I have tried to change a link on a web page from a simple "mailto" link to a button that inludes a mailto.

The command line I used includes the instruction
onclick="parent.location='mailto:info@

If I try to use the page with this command, the mail programme is called and the email is sent but is never received in the mail box.

I presume it is in hte definition of the parent.location. I have asked the support people at the hosting site, all I get is that the whole of the bin is cgi enabled,

Any suggestions gratefully received

Thanks

Rob

They have: 2 posts

Joined: Apr 2007

Have you tried:

OnClick="mailto:[email protected]"

They have: 2 posts

Joined: Apr 2007

derekharvey;218194 wrote: Have you tried:

OnClick="mailto:[email protected]"

Did try that, but nothing happens

Suggestions appreciated. Currently I am not using CSS so easiest solutions please

Rob

He has: 1,380 posts

Joined: Feb 2002

Try using a function?

<input .... onClick="sendEmail(the_id)" />'

function sendEmail(the_id) {
    document.write('mailto:[email protected]');
}
'

I'm not really sure if that will even work, but maybe try implementing a function rather than use a direct javascript command. That's my basic point.

They have: 2 posts

Joined: Apr 2007

This works, i have also added the ablity to add a default subject and default body text. This should work fine.

<script>
function openEmailClient(emailAddress, theSubject, theBody)
{
var locationString = '';
if (!emailAddress)
alert("No E-mail Specified");
else
{
locationString += 'mailto:' + emailAddress + '?1=1';

if (theSubject)
locationString += '&subject=' + theSubject;

if (theBody)
locationString += '&body=' + theBody;

window.location = locationString;
}
}
</script>

click me

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.