Detailed description of ASP output wrapping [original]_ application Tips

Source: Internet
Author: User

Test code: Output Simple ul Li
1.asp

Copy Code code as follows:

<%
Response.Write "<ul>"
Response.Write "<li> cloud-Habitat community </li>"
Response.Write "<li>www.jb51.net</li>"
Response.Write "</ul>"
%>

The result is that the right key source file sees the
Copy Code code as follows:

<ul><li> Cloud-dwelling community </li><li>www.jb51.net</li></ul>

1, if for the characters in the source file output good-looking, conducive to the optimization of reading and other reasons, you can use vbCrLf
Code written
Copy Code code as follows:

<%
Response.Write "<ul>" &vbcrlf
Response.Write "<li> cloud-Habitat community </li>" &vbcrlf
Response.Write "<li>www.jb51.net</li>" &vbcrlf
Response.Write "</ul>"
%>

The source of the output is
Copy Code code as follows:

<ul>
<li> Cloud-dwelling community </li>
<li>www.jb51.net</li>
</ul>

The second: if it is a normal file, the middle can be used
Copy Code code as follows:

Response.Write "<div> cloud-Habitat community <br>www.jb51.net</div>"

The third: if it is to be shown in textarea and HTML in turn, then
This is typically done by textarea instead of Web page editing, so you need to replace textarea with <br>
CHR (10) indicates a newline, CHR (13) indicates carriage return
Line breaks in ASP can be used by constants: vbCrLf and Functions: Chr (13);
Copy Code code as follows:

Response.Write "Landing Success" &vbcrlf& "Welcome to use"
Content=replace (Content, "vbCrLf", "<br>")-

The following is the replacement of line wrapping in textarea with <br>
Copy Code code as follows:

fstring = Replace (fstring, CHR (), "<br>")
fstring = Replace (fstring, CHR (), <br>)

If, in turn, the BR wrap in HTML needs to be replaced with a newline in textarea
Copy Code code as follows:

fstring = Replace (fstring, <br>, vbCrLf)

More specific no longer write, we can test themselves, the program is written side of the test out. Not to see it.

Other statements
Recently in the writing ASP program, want to let my HTML code directly in the ASP output, and asked him in a very neat format to output. I tried the long time to write \ n, t these long-term use of watchmaking symbols, can not directly output, so diplodocus in Baidu to check the relevant information, posted out, so that attention to Diplodocus and Diplodocus blog friends can get the accumulation of knowledge. Diplodocus before learning ASP, seemingly not too concerned about this, now is done to make up eight. All right, straight up.

vbcr Chr (13) carriage return character.

VbCrLf Chr & Chr (10) Carriage return and line feed.

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.