Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > add carriage return?!

Reply
Thread Tools

add carriage return?!

 
 
Geoff Cox
Guest
Posts: n/a
 
      09-13-2005
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>

 
Reply With Quote
 
 
 
 
Geoff Cox
Guest
Posts: n/a
 
      09-13-2005
On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
<(E-Mail Removed)> 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


 
Reply With Quote
 
 
 
 
ASM
Guest
Posts: n/a
 
      09-13-2005
Geoff Cox wrote:
> On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
> <(E-Mail Removed)> 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
 
Reply With Quote
 
Mick White
Guest
Posts: n/a
 
      09-13-2005
Geoff Cox wrote:

> On Tue, 13 Sep 2005 09:57:16 GMT, "Zoe Brown"
> <(E-Mail Removed)> 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
 
Reply With Quote
 
Geoff Cox
Guest
Posts: n/a
 
      09-13-2005
On Tue, 13 Sep 2005 13:52:35 GMT, Mick White
<(E-Mail Removed)> 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

 
Reply With Quote
 
Robi
Guest
Posts: n/a
 
      09-13-2005
ASM wrote in message news:4326d934$0$7852$(E-Mail Removed)...
> 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
 
Reply With Quote
 
Geoff Cox
Guest
Posts: n/a
 
      09-13-2005
On Tue, 13 Sep 2005 15:48:29 +0200, ASM
<(E-Mail Removed)> wrote:

>try :
>
> \n\r
>
>or : \\n
>or : \\r
>or : \\n\\r


Stephane

I have tried all and no go!?

Cheers

Geoff

 
Reply With Quote
 
ASM
Guest
Posts: n/a
 
      09-13-2005
Geoff Cox wrote:
> On Tue, 13 Sep 2005 15:48:29 +0200, ASM
> <(E-Mail Removed)> 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='(E-Mail Removed)?'+
'subject=saluti a tuti&body='+asm;
return false;
">mail</a>
</html>

works fine for me at home



--
Stephane Moriaux et son [moins] vieux Mac
 
Reply With Quote
 
Geoff Cox
Guest
Posts: n/a
 
      09-13-2005
On Tue, 13 Sep 2005 21:02:50 +0200, ASM
<(E-Mail Removed)> 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='(E-Mail Removed)?'+
> '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

 
Reply With Quote
 
Geoff Cox
Guest
Posts: n/a
 
      09-14-2005
On Tue, 13 Sep 2005 13:52:35 GMT, Mick White
<(E-Mail Removed)> 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




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Xyplex double carriage returns when using tftp Chris_D Cisco 1 02-19-2006 10:16 PM
How to match carriage returns and line feeds Schroeder Perl 1 01-26-2005 06:53 PM
Help: Delete a single carriage return in a file, but not a double carriage return? Steve Anderson Perl Misc 3 06-21-2004 12:48 AM
Carriage Returns and sockets Iceberg Perl 1 09-06-2003 04:49 PM
FTP doesn't add Carriage Return from VMS to NT? Mike O'Neal Perl Misc 5 08-12-2003 07:37 PM



Advertisments