VbCrLf in jscript

  • Thread starter Christopher Brandsdal
  • Start date
C

Christopher Brandsdal

Hi!

Im still working on some <%@ LANGUAGE=JScript %> code ;)

What is the same command as VbCrLf in JScript?
I just want my HTML to jump one line down...
hehe

I know I should know... ;)
 
T

Tim Slattery

Christopher Brandsdal said:
Hi!

Im still working on some <%@ LANGUAGE=JScript %> code ;)

What is the same command as VbCrLf in JScript?
I just want my HTML to jump one line down...
hehe

There's no macro in JScript like VbCrLf. You can use \n for a newline,
but remember that neither VbCrLf nor \n will cause a linebreak that's
visible in your browser. For that, you need to send the HTML tag <BR>.
Or possibly <P> or <DIV>. Browsers ignore things like extra spaces and
newlines in the HTML they are rendering.
 
E

Evertjan.

Tim Slattery wrote on 03 jun 2004 in
microsoft.public.inetserver.asp.general:
There's no macro in JScript like VbCrLf. You can use \n for a newline,
but remember that neither VbCrLf nor \n will cause a linebreak that's
visible in your browser. For that, you need to send the HTML tag <BR>.
Or possibly <P> or <DIV>. Browsers ignore things like extra spaces and
newlines in the HTML they are rendering.

However ASP (VBS and JS) can produce far more than HTML content, where
this can be usefull.

vbs [IE]:

myCrLf = chr(10) & chr(13)
alert("a" & myCrLf & "b")

js:

myCrLf = String.fromCharCode(10, 13);
alert('a' + myCrLf + 'b')
 
E

Evertjan.

Aaron [SQL Server MVP] wrote on 03 jun 2004 in
microsoft.public.inetserver.asp.general:
Isn't a true carriage return + line feed represented as \r\n ?

Under jscript/ASP yes:

<%@Language=Jscript%>
<%

myCrLf = "\r\n"
Response.write(myCrLf.length) // 2

Response.write("<br>")

myLf = "\n"
Response.write(myLf.length) // 1

%>

======================

It could depend on the platform/OS used.
Perhaps some applications could use \n as crlf?

That's why I would play for sure, when I don't know the OS:

String.fromCharCode(10, 13)
 
C

Christopher Brandsdal

Tim Slattery said:
There's no macro in JScript like VbCrLf. You can use \n for a newline,
but remember that neither VbCrLf nor \n will cause a linebreak that's
visible in your browser. For that, you need to send the HTML tag <BR>.
Or possibly <P> or <DIV>. Browsers ignore things like extra spaces and
newlines in the HTML they are rendering.
I know the browser doesn't read the extra space, but that's not what I
needed anyway ;)

Just had to make a line-jump to make my HTML design work perfectly....
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top