Detailed asp output line feed original

Source: Internet
Author: User

Test code: Output simple ul li
1. asp

Copy codeThe Code is as follows: <%
Response. write "<ul>"
Response. write "<li> script home </li>"
Response. write "<li> www.jb51.net </li>"
Response. write "</ul>"
%>

The result is: Right-click the source file and you will seeCopy codeThe Code is as follows: <ul> <li> script home </li> <li> www.jb51.net </li> </ul>

1. You can use vbcrlf
Write codeCopy codeThe Code is as follows: <%
Response. write "<ul>" & vbcrlf
Response. write "<li> script home </li>" & vbcrlf
Response. write "<li> www.jb51.net </li>" & vbcrlf
Response. write "</ul>"
%>

The output source code isCopy codeThe Code is as follows: <ul>
<Li> foot home </li>
<Li> www.jb51.net </li>
</Ul>

Second: if it is a common file, you can use
Copy codeThe Code is as follows: response. write "<div> script home <br> www.jb51.net </div>"

Third: to display textarea and html in turn
In this case, the content is submitted through textarea instead of the webpage editing, so you need to replace the line feed of textarea with <br>
CHR (10) indicates line feed, and CHR (13) indicates carriage return.
In asp, you can use the constant vbcrlf and function: chr (13) for line breaks;Copy codeThe Code is as follows: response. write "Login successful" & vbcrlf & "welcome"
Content = replace (content, "vbcrlf", "<br> ")-

Replace the line feed in textarea with <br>Copy codeThe Code is as follows: fString = Replace (fString, CHR (10), "<br> ")
FString = Replace (fString, CHR (13), "<br> ")

In turn, the line feed of br in html must be replaced with the line feed in textarea.Copy codeThe Code is as follows: fString = Replace (fString, <br>, vbcrlf)

More specifically, you can test the program by writing it. Not shown.

Other statements
Recently, when I was writing an ASP program, I wanted my HTML code to be output directly in ASP and asked him to output it in a very neat format. I tried the long-used tabulation symbols \ n and \ t that I wrote for a long time and couldn't be directly output. So Liang long checked the relevant information on Baidu and posted it, this allows friends who are interested in Liang long and Liang Long's blogs to accumulate knowledge. When Liang long studied ASP, he didn't seem to care too much about it. Now, he can make up for eight. Okay, go to the above.

VbCr Chr (13) carriage return.

VbCrLf Chr (13) & Chr (10) returns and linefeeds.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.