-
May 12th, 2001, 11:49 PM
#1
Thread Starter
Fanatic Member
Question about Server-side JScript
Ok, most of you know that you can output a new line in vbscript with vbCrLf. Is there anything like this in jscript?
Alcohol & calculus don't mix.
Never drink & derive.
-
May 13th, 2001, 05:00 AM
#2
Hyperactive Member
check out \n
alert('blah\nmore blah on a new line');
-
May 13th, 2001, 11:17 AM
#3
Thread Starter
Fanatic Member
Yes that would work for an alert, but i wanted to do something like:
Response.Write("<p>some text</p>\n");
Response.Write("<p>more text</p>");
and get the output of:
some text
more text
instead of
some textmore text
but the \n won't insert a new line in the output. I tried \r too, but that doesn't work either.
Alcohol & calculus don't mix.
Never drink & derive.
-
May 13th, 2001, 12:37 PM
#4
Guru
the \n will insert a new line in your output, but since browsers ignore carriage returns, you must output a <br> instead of a \n where you want the line break to occur
In other words, if you output a \n, your output will have a carriage return in it, but this is ignored by the browser. If you output a <br>, you will NOT have a carriage return in the output, but the browser will display a line break
I hope that makes sense....
Tom
-
May 15th, 2001, 06:26 PM
#5
Thread Starter
Fanatic Member
I understand, but \n does not output a carriage return. When i look at the generated source, the \ns are all the little black box "undefined character"...all on one line.
Alcohol & calculus don't mix.
Never drink & derive.
-
May 15th, 2001, 06:30 PM
#6
PowerPoster
Yeah, i have had this problem too. Why isin't there something like Response.Writeln?
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
May 15th, 2001, 08:35 PM
#7
Guru
There is something with the way Javascript outputs the new lines and notepad not recognizing it properly (you get the little box)
In windows 2000, notepad properly recognizes the new line, but in 9x or NT it appears as a little box. If you were to open that same source file in any other word processing program, the boxes are shown properly, so the CRLF does exist
-
May 16th, 2001, 05:45 PM
#8
Thread Starter
Fanatic Member
I think i got it. You have to do \r\n. As in Response.write("Hello\r\nWorld"); gets you
Hello
World
.
Alcohol & calculus don't mix.
Never drink & derive.
-
May 16th, 2001, 06:02 PM
#9
PowerPoster
How did you figure that one out?
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
May 16th, 2001, 06:16 PM
#10
Thread Starter
Fanatic Member
Trial and error my friend.
Alcohol & calculus don't mix.
Never drink & derive.
-
May 16th, 2001, 07:32 PM
#11
PowerPoster
But what exactly does \r do? Is it like \return?
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
May 16th, 2001, 07:33 PM
#12
Thread Starter
Fanatic Member
Yeah, I think so, carriage return or something.
Alcohol & calculus don't mix.
Never drink & derive.
-
May 17th, 2001, 12:33 AM
#13
Guru
Sweet!
here's a list of some escape sequences I found in my Java book:
\b Backspace
\f Form Feed
\n New Line
\r Carriage Return
\t Tab
I wonder why \n doesn't do the same thing as \f\r? weird. Thanks Wynd, I need that \r for a project I'm working on
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|