Mailto - insert body in mail from variable

heya

I’m using mailto function on my page; I have textarea field where user can write some text, now I want to include that text in body of email, when user click on mailto function which is behind link.

The problem is how to prepare link for mailto function. I did some experiments, but I have still some problems. When I click on link (well now is mouseover efect) new page is loaded and mailto is prepared.

Any sugestions how to change the code, that the function will work as I wish?

thanx in advance :wink:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250"/>
<title>testing mailto</title>
</head>
<body>

<form id="test">

<p>

<input type="textarea" name="test" id="test" size="10" value="tralala">

<a OnMouseOver="protectmail2()">mail me test value</a>

</p>


</form>
<script language="JavaScript" type="text/javascript">
var name = "webmaster";
var address = "domain.com";
var link = "Mail me!";
var subject = "Feedback";
var body = document.getElementById("test").test.value;
function protectmail2() {
document.write('<a href=mailto:' + name + '@' + address + '?subject=' + subject + '&body=' + body + '>' + link + '</a>');
}
</script>
</body>
</html>

Ah, if it was only so easy. You can use javascript to write a mailto link. And you can use javascript to add GET variables to a http request’s URL. :frowning: Sorry, but I know of no way to send emails with only javascript.

it’s a bit tricky i know, the script must prepare mailto link “onmouseover” some link/or text. In general now works something like that, the problem is that on “onmouseover event” link is created in new page … the solution shouldn’t be far away