473,416 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Linefeed problem - please help

Good afternoon,
I would like to join several elements in one string. Every element should
have its own line.
After this I would like to display the string on a document.
The following code inserts a space between the elements but the are all in
one line.
Where is my mistake ?
Thank you for any hint.
Best regards
Jürgen Heyn, Wilhelmshaven, Germany

function CreateMailText()
{
var MailText = ""
var obj = self.Inhalt.document;
MailText += "Lieferanschrift\n";
MailText += obj.forms[0].Firma1.value+"\n";
MailText += obj.forms[0].Anrede1.value+"\n";
MailText += obj.forms[0].Vorname1.value+"\n";
MailText += obj.forms[0].Nachname1.value+"\n";

obj.clear();
obj.open();
obj.write('<html>');
obj.write('<head>');
obj.write('</head>');
obj.write('<body bgproperties="fixed"
background="Bilder/Hintergrund.gif">');
obj.write('</head>');
obj.write(MailText);
obj.write('</body>');
obj.write('</html>');
obj.close();
}
Jul 20 '05 #1
5 2989
Jürgen Heyn wrote:
Good afternoon,
I would like to join several elements in one string. Every element should
have its own line.
After this I would like to display the string on a document.
The following code inserts a space between the elements but the are all in
one line.
Where is my mistake ?
Thank you for any hint.
Best regards
Jürgen Heyn, Wilhelmshaven, Germany

function CreateMailText()
{
var MailText = ""
var obj = self.Inhalt.document;
MailText += "Lieferanschrift\n";
MailText += obj.forms[0].Firma1.value+"\n";
MailText += obj.forms[0].Anrede1.value+"\n";
MailText += obj.forms[0].Vorname1.value+"\n";
MailText += obj.forms[0].Nachname1.value+"\n";

obj.clear();
obj.open();
obj.write('<html>');
obj.write('<head>');
obj.write('</head>');
obj.write('<body bgproperties="fixed"
background="Bilder/Hintergrund.gif">');
obj.write('</head>');
obj.write(MailText);
obj.write('</body>');
obj.write('</html>');
obj.close();
}


What browser are you using? I have never run into this, but my
intuition would say that you might need to do a carriage return/line
feed, instead of a simple line feed. IOW, "\r\n" instead of "\n".

Unless of course, you are talking about the way that the actual browser
looks. In that case, this is an HTML issue... use <BR>

:)
Brian

Jul 20 '05 #2
On Fri, 20 Feb 2004 15:03:43 +0100, Jürgen Heyn <j.****@gmx.de> wrote:
I would like to join several elements in one string. Every element should
have its own line.
After this I would like to display the string on a document.
The following code inserts a space between the elements but the are all
in one line.
Where is my mistake ?


[snip]

You can use document.writeln() in place of document.write(). The former
automatically adds a new line after the text has been written, whereas the
latter does not (as you have discovered).

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #3
Jürgen Heyn wrote:
Good afternoon,
I would like to join several elements in one string. Every element should
have its own line.
After this I would like to display the string on a document.
The following code inserts a space between the elements but the are all in
one line.
Where is my mistake ?
Thank you for any hint.
Best regards
Jürgen Heyn, Wilhelmshaven, Germany

function CreateMailText()
{
var MailText = ""
var obj = self.Inhalt.document;
MailText += "Lieferanschrift\n";
MailText += obj.forms[0].Firma1.value+"\n";
MailText += obj.forms[0].Anrede1.value+"\n";
MailText += obj.forms[0].Vorname1.value+"\n";
MailText += obj.forms[0].Nachname1.value+"\n";


MailText += obj.forms[0].Nachname1.value + "\n<br />";

The \n will put a new line in the source code, but the br tag is
required to put a new line in the display.

Do it for each and every line above
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #4
JRS: In article <c1*************@ID-94872.news.uni-berlin.de>, seen in
news:comp.lang.javascript, Jürgen Heyn <j.****@gmx.de> posted at Fri, 20
Feb 2004 15:03:43 :-
I would like to join several elements in one string. Every element should
have its own line.
After this I would like to display the string on a document.
The following code inserts a space between the elements but the are all in
one line.
Where is my mistake ?


Since you are apparently writing to a page, ISTM likely that you need
<br> instead of \n; or that you should enclose that part in <pre> ...
</pre>.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links;
some Astro stuff via astro.htm, gravity0.htm; quotes.htm; pascal.htm; &c, &c.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Jul 20 '05 #5
Good afternoon,

thank you very much for your help.
I now got the difference between "\n" and the <br> tag.
To generate a *.html page I use the <br> tag.
Joining the the textlines to be displayed as a .value property of a textarea
I the "\n".
Again thank you very much.
Everybody have a nice weekend.
Best regards
Juergen Heyn, Wilhelmshaven, Germany
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Johannes Busse | last post by:
Hello, I use saxon 6.5.3. under SuSE 9.1. In my stylesheet I give out messages like <xsl:message> <xsl:value-of select="$myId" /> <xsl:text> | </xsl:text> </xsl:message>
2
by: Jürgen Heyn | last post by:
Good afternoon, in a form a multiline textbox is defined: <textarea name="text" cols="25" rows="3">This is the text. this should be line 2</textarea> In the textbox the linefeed is displayed...
3
by: Wade G. Pemberton | last post by:
Help!: I use javascript to format repetitive data from a web page input FORM into a long string , and save it as lines of comma delimited data in a text file on a Unix server. The text...
7
by: Michael G. Schneider | last post by:
From ASP I create response, which is to be shown as an Excel worksheet in the user's browser (by setting the ContentType and creating a table). This works fine. Does anybody know what to do, if...
2
by: cloudx | last post by:
Hi there, Here is the line of VB code and I would like to translate into C#, please help! Thanks! sMsgIntHeader = (Replace(Replace(Trim(Left(sErrorMsg, InStr(5, sErrorMsg, vbCrLf))), vbLf,...
8
by: Able | last post by:
Dear friends How do I by code identify linefeed in a string and delete it? Regards Able
1
by: sck10 | last post by:
Hello, When I open a FormView in View mode, the line breaks are missing, but they show up when I enter edit mode. So I tried to use the following on a Textbox with a replace function, but got...
1
by: Tor Inge Rislaa | last post by:
DataList removes the linefeed When entering the text below in a field in my database with data type TEXT it is displayed as below, line by line. Line1 Line2
10
by: Bob Quintal | last post by:
I'm receiving data in text files from a unix sustem that onlu puts a Lf character at the end of each row. Access insists on Cr or CrLf or it sees the file as 1 row 700Kb wide and chokes. Is...
2
by: Mark B | last post by:
How can I put a linefeed in some header text (I am using the Datagrid control and editing the header properties for a field)? Average Sales Average Returns Average Sales ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.