You are here: irt.org | FAQ | JavaScript | Email | Q1016 [ previous next ]
YMMV depending on the browser and email client, but try:
<script language="JavaScript"><!-- function update(what) { what.action = 'mailto:' + document.hiddenForm.emailAddress.value + '?SUBJECT=' + document.hiddenForm.subjectLine.value; what.elements[' '].value += '\n\n'; } //--></script> <form name="hiddenForm" onSubmit="return false"> Email Address: <input type="text" name="emailAddress"> <input type="hidden" name="subjectLine" value="Hello World"> </form> <form name="emailForm" method="post" enctype="text/plain"> Message Body: <textarea name=" "></textarea> <input type="submit" onClick="update(this.form)"> <input type="hidden" name="Internet Related Technologies - <URL" value="http://www.irt.org/>"> </form>
Which sends an email message looking like:
Subject: Hello World Date: Mon, 05 Apr 1999 19:42:56 +0000 From: Martin Webb <martin@irt.org> Organization: irt.org - http://www.irt.org To: martin@irt.org =this is a test Internet Related Technologies - <URL=http://www.irt.org/>
You cannot avoid the "=" sign. Although you could make it appear as part of the message with something like:
<script language="JavaScript"><!-- function update(what) { what.action = 'mailto:' + document.hiddenForm.emailAddress.value + '?SUBJECT=' + document.hiddenForm.subjectLine.value; what.elements[' '].value = ' Subject Heading =\n\n' + what.elements[' '].value + '\n\n'; } //--></script> <form name="hiddenForm" onSubmit="return false"> Email Address: <input type="text" name="emailAddress"> <input type="hidden" name="subjectLine" value="Hello World"> </form> <form name="emailForm" method="post" enctype="text/plain"> Message Body: <textarea name=" "></textarea> <input type="submit" onClick="update(this.form)"> <input type="hidden" name="Internet Related Technologies - <URL" value="http://www.irt.org/>"> </form>
which appears as:
Subject: Hello World Date: Mon, 05 Apr 1999 19:47:14 +0000 From: Martin Webb <martin@irt.org> Organization: irt.org - http://www.irt.org To: martin@irt.org = Subject Heading = this is a test Internet Related Technologies - <URL=http://www.irt.org/>