By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,553 Members | 871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,553 IT Pros & Developers. It's quick & easy.

Re: How to insert text on multiple lines - in "body" of mailto:

P: n/a

"G. Morgan" <no***@il.invalidwrote in message
news:87********************************@mypost.inv alid...
<I don't have access to a server-side app. so this must be done client

How do I get:
(thebody)+(dropdown) to appear on their own lines in the resulting email?
function now()
var thebody=document.testform.thebody.value;
var dropdown=document.testform.dropdown.value;
window.location.href="mailto:no***** ubject=Mail Test&body="
Did you try <cr><lf[chr(10) + chr(13) or other way around] combination?
** Posted from **
Aug 10 '08 #1
Share this Question
Share on Google+
2 Replies

P: n/a
On Aug 10, 6:53 pm, G. Morgan <no...@il.invalidwrote:
GArlington wrote:
Did you try <cr><lf[chr(10) + chr(13) or other way around] combination?

No, how would I do that?

It takes a big man to cry,
but it takes a bigger man to laugh at that man. -Jack Handey

Take back Usenet <-->
<a href="mailto:bl** y=The message's
first paragraph.%0ASecond paragraph.%0AThird Paragraph.">mailto</a>
Aug 12 '08 #2

P: n/a
GArlington wrote:

<a href=" y=The message's
first paragraph.%0ASecond paragraph.%0AThird Paragraph.">mailto</a>
An end-of-line character can only be written as %0D%0A here. RFC 2368:

| Also note that line breaks in the body of a message MUST be
| encoded with "%0D%0A".

The example stands a bit further:

| <mailto:in*****
| issue%0D%0Asend%20index>

Also, spaces are not allowed, they must be written as %20. Apostrophes
can be written as ' or %27, my preference goes to %27. The variables
'thebody' and 'dropdown' must be percent-encoded before they can be
used inside an URI.

All together:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<title>Feedback Form</title>
<script type="text/javascript">
function now() {
var thebody = escape(document.testform.thebody.value);
var dropdown = escape(document.testform.dropdown.value);
window.location.href = "mailto:no*****"
+ "subject=Mail%20Test&body="
+ thebody
+ '%0D%0A'
+ dropdown;
<form name="testform" method="get" action="#"
onSubmit="return false;">
<textarea name="thebody" rows="5" cols="30">This is test.</textarea>
<select size="1" name="dropdown">
<option value="yes">yes</option>
<option value="no">no</option>
</selectchoose yes or no.</p>
<p><input type="button" value="click me" onClick="now();"></p>


To the original poster: I've altered your code so that it's now valid
HTML (4.01, transitional), please see for details.
Also be careful for leading/trailing end-of-line characters inside
<textarea>. I removed them in any case.

Hope this helps,

Aug 12 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.