add carriage return?!

G

Geoff Cox

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] + ' ';
}
}
document.write(results);

}
</script>

</head>

<body>

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

</body>
</html>
 
G

Geoff Cox

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


results += window["text_" + z] + ' <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
 
A

ASM

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


results += window["text_" + z] + ' <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
 
M

Mick White

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


results += window["text_" + z] + ' <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
 
G

Geoff Cox

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
 
R

Robi

ASM wrote in message news:[email protected]...
Geoff said:
How do I get a carriage return after each of the names?!
results += window["text_" + z] + ' <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
 
A

ASM

Geoff said:
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:[email protected]?'+
'subject=saluti a tuti&body='+asm;
return false;
">mail</a>
</html>

works fine for me at home
 
G

Geoff Cox

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:[email protected]?'+
'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
 
G

Geoff Cox

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

In javascript, XML File Create, File Save 2
Help with code 0
JQuery add shadow error 4
Song requests 4
I want to Display Excel As HTML In js 2
Help :( 3
Check forms With JavaScript 1
JavaScript code not working!! 6

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top