Form Sends Email With Subject and Body Set

[Total: 0    Average: 0/5]

This script shows how to have javascript send email.

Head Code:

<script>
function doIt()
{
  var S=document.exf2.subject.value;
  var B=document.exf2.body.value;
  self.location="mailto:someone@somewhere.com?subject="+S+"&body="+B;
}
</script>

Body Code:

This example escapes the text (replaces spaces with plus signs)
<form name=exf1 action="mailto:someone@somewhere.com" method=GET>
SUBJECT:<input type=text name=subject value="the subject"><BR>
BODY:<input type=text name=body value="the body"><BR>
<input type=submit>
</form>
<HR>
This examples does not escape the text.
<form name=exf2>
SUBJECT:<input type=text name=subject value="the subject"><BR>
BODY:<input type=text name=body value="the body"><BR>
<input type=button value="SUBMIT" onclick="doIt()">
</form>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *