HTML with Javascript sending email from a form. Not sure why this isn't working.?

David P

New member
Hello everyone.
What I am trying to do is have the ability to send email (or worst case senerio) open the default mail client and send an email.

Here is what I have so far.
I have 2 textboxes and a textarea, and a submit button. However, I am trying to capture the name subject and body to send. I can get it to open in a mail client but I can't get the text I want to appear (which will vary). So for instance the email, subject I can't get to appear. For some reason the variable name is appearing. Below is my code. Any help would be great.

<html>

<head>
<script type="text/javascript">
function sayHi()
{
var txtName = document.getElementById(email);
var txtOutput = document.getElementById("Subject").value…

}
</script>

</head>

<body>

<input type="text" id="email">

<input type="subject">

<textarea rows="5" cols="20" id="Box"> </textarea>

<a href="mailto:txtName?subject=txtOutput&b… Email</a>

<input type="button" value="Send email" onClick="sayHi()">




</body>

</html>

Thank you,
 
Back
Top