Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between writeln and write in javascript

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces what is the difference between writeln and write in javascript. It is very detailed and has certain reference value. Friends who are interested must read it!

The difference between writeln and write in javascript: when the writeln () method outputs data in the browser, it adds a newline character to the end of the data, while the write () method does not add a newline character to the end of the data in the browser, so it cannot wrap.

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

Javascript provides two ways to display data directly in a browser. You can use write () and writeln (), which are methods of the document object.

The writeln () method is almost the same as the write () method, except that Write cannot wrap, and Writeln can wrap.

Writeln () will add a newline character after any string provided. The write () method does not add a newline character to the end of the string.

Note: the line wrapping effect of writeln can not be seen in the web page, it is displayed by the browser as a space.

You can't see the effect in both the HTML file and the source file of JSP. Readers can add pre-formatted tags to the tags to view the effect.

[xss_clean] ("write"); [xss_clean] ln ("writln"); [xss_clean] ("write")

You can also use the open method to open a new window to view the test

With (window.open ()) {[xss_clean] ("write") [xss_clean] ln ("writeln") [xss_clean] ln ("write")}

Then you can see the effect by viewing the web page source file in the pop-up window.

The above is all the content of the article "what is the difference between writeln and write in javascript". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report