We often have to dynamically display the content from the file in the Web page, if you write a chat room or a forum program, the content of each speaker must first exist in a text file, and then displayed on the page. But the control that lets users enter content on a Web page is a text box. When the contents of a text box are displayed on a Web page, you cannot display a character like a space or a newline, which means there is no paragraph. To display a paragraph on a Web page, you must insert an HTML flag in the space that we enter the text, the newline character entered prompt to display the characters, see the example below.
If the page is a chat room screen, we enter the content in the text box, click "Submit" can be on the page to display our content, the text box named Text1, we use the following method can be very clever to display text wrapping and space function.
<%
......
......
Str=request.querystring ("Text1")
Str=replace (str, CHR (32), "")
' Replace the space with the &NBSP sign
Str=replace (str, vbCrLf, "<br>")
' Change the carriage return line break to <br> sign
Response.Write Str
......
......
%>
After the above code, we will change the text in the return line to the browser can recognize the <br> line label, and the space for   space mark. where Chr (32) represents a space, vbCrLf indicates a carriage return line break.
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