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

add carriage return?!

P: n/a
Hello,

How do I get a carriage return after each of the names?!

Cheers

Geoff

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>

<script>

var results="";

var text_0 = new Array(2);
text_0[0] = "becky";
text_0[1] = "jim";

var text_1 = new Array(2);
text_1[0] = "fred";
text_1[1] = "susan";

function save()
{

for (var z= 0; z <2; z++)
{

for (var i = 0; i < 2; i++)
{
results += window["text_" + z][i] + ' ';
}
}
document.write(results);

}
</script>

</head>

<body>

<button onclick="save()">try</button>

</body>
</html>

Sep 13 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
How do I get a carriage return after each of the names?!

results += window["text_" + z][i] + ' <br>';
Sep 13 '05 #2

P: n/a
On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
<zo***********@N-O-S-P-A-A-Mtesco.net> wrote:
How do I get a carriage return after each of the names?!

results += window["text_" + z][i] + ' <br>';


Zoe,

That works fine in the code I posted but will not work when I use this
method when sending data via email using formmail.cgi - any idea what
to use there?

Cheers

Geoff
Sep 13 '05 #3

P: n/a
ASM
Geoff Cox wrote:
On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
<zo***********@N-O-S-P-A-A-Mtesco.net> wrote:

How do I get a carriage return after each of the names?!

results += window["text_" + z][i] + ' <br>';

Zoe,

That works fine in the code I posted but will not work when I use this
method when sending data via email using formmail.cgi - any idea what
to use there?


try :

\n\r

or : \\n
or : \\r
or : \\n\\r
--
Stephane Moriaux et son [moins] vieux Mac
Sep 13 '05 #4

P: n/a
Geoff Cox wrote:
On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
<zo***********@N-O-S-P-A-A-Mtesco.net> wrote:

How do I get a carriage return after each of the names?!

results += window["text_" + z][i] + ' <br>';

Zoe,

That works fine in the code I posted but will not work when I use this
method when sending data via email using formmail.cgi - any idea what
to use there?

Try "\n" instead of <br> , your server should be able to handle it...
Mick
Sep 13 '05 #5

P: n/a
On Tue, 13 Sep 2005 13:52:35 GMT, Mick White
<mw***********@rochester.rr.com> wrote:
Try "\n" instead of <br> , your server should be able to handle it...
Mick


Mick

I have and no go - have also tried String.fromCharCode() but stll
cannot separate the parts of the string ... so that they start on new
lines in the email sent by formmail-nms....

Cheers

Geoff

Sep 13 '05 #6

P: n/a
ASM wrote in message news:43**********************@news.wanadoo.fr...
Geoff Cox wrote:
On Tue, 13 Sep 2005 09:57:16 GMT, Zoe Brown wrote:
How do I get a carriage return after each of the names?!
results += window["text_" + z][i] + ' <br>';


Zoe,

That works fine in the code I posted but will not work when I use this
method when sending data via email using formmail.cgi - any idea what
to use there?


try :

\n\r

or : \\n
or : \\r
or : \\n\\r


Stephane, either you're being ignored, or Geoff thinks you're saying
the same as he already tried ;-)

Geoff,

\n = new line
\r = carriage return

you might want to try yhe latter or the combination of both - as in cr/nl

HTH
Sep 13 '05 #7

P: n/a
On Tue, 13 Sep 2005 15:48:29 +0200, ASM
<st*********************@wanadoo.fr.invalid> wrote:
try :

\n\r

or : \\n
or : \\r
or : \\n\\r


Stephane

I have tried all and no go!?

Cheers

Geoff

Sep 13 '05 #8

P: n/a
ASM
Geoff Cox wrote:
On Tue, 13 Sep 2005 15:48:29 +0200, ASM
<st*********************@wanadoo.fr.invalid> wrote:

try :

\n\r

or : \\n
or : \\r
or : \\n\\r

Stephane

I have tried all and no go!?

Ha? yes ! you're right ! :-(

try with : %0D%0A

because that :

<html>
<a href="#" onclick="
var asm = 'hello,%0D%0A%0D%0Athere is a little message to%0D%0Asee '+
'if return carriages%0D%0Aare understood';
alert(asm);
location.href='mailto:tr**@machin.com?'+
'subject=saluti a tuti&body='+asm;
return false;
">mail</a>
</html>

works fine for me at home

--
Stephane Moriaux et son [moins] vieux Mac
Sep 13 '05 #9

P: n/a
On Tue, 13 Sep 2005 21:02:50 +0200, ASM
<st*********************@wanadoo.fr.invalid> wrote:
Ha? yes ! you're right ! :-(

try with : %0D%0A

because that :

<html>
<a href="#" onclick="
var asm = 'hello,%0D%0A%0D%0Athere is a little message to%0D%0Asee '+
'if return carriages%0D%0Aare understood';
alert(asm);
location.href='mailto:tr**@machin.com?'+
'subject=saluti a tuti&body='+asm;
return false;
">mail</a>
</html>

works fine for me at home


Stephane,

Thanks - will give it a try tomorrow - a bit late now - nearly 1am

Cheers

Geoff

Sep 13 '05 #10

P: n/a
On Tue, 13 Sep 2005 13:52:35 GMT, Mick White
<mw***********@rochester.rr.com> wrote:
Try "\n" instead of <br> , your server should be able to handle it...


Mick,

Someone has given me the answer!

I used escape()

ie escape("\n")

!!

Cheers

Geoff


Sep 14 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.