In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how line breaks are expressed in javascript. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The expression of line break is as follows: (1) the newline character "\ n", insert "\ n" directly where you want to break the line, and insert "\ r" directly where you want to break the line. 3. "
"tags that can be inserted where you want to wrap when writing to an HTML document."
"tag to wrap the line.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
The representation of line feeds in javascript
1. Newline character "\ n"
In JavaScript, we can use\ nline feeds directly where we want to wrap:
Alert ("first line\ nsecond line")
Output result:
2. Newline character "\ r"
You can also use\ r to wrap lines directly where you want to wrap:
Alert ("hello\ rworld")
Output result:
3. HTML's
Label
When you can write content to an HTML document, you can use the HTML
Tag to wrap the line.
Example: use [xss_clean] () or innerHTML attribute
Document.getElementById ("p") [xss_clean] = "hello
World "; [xss_clean] (" first line
Second line ")
Output result:
Thank you for reading! This is the end of the article on "how to express line breaks in javascript". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
First, download the Eclipse UML plug-in for free. Log in to http://
© 2024 shulou.com SLNews company. All rights reserved.