Why doesn't javascript newlines work inside html?

后端 未结 13 2617
梦谈多话
梦谈多话 2020-12-06 12:08

So I have the following:


  
    
  
<         


        
13条回答
  •  悲&欢浪女
    2020-12-06 12:49

    1,3. "\n" does work. If you do a document.write inside the body tag you can check document.body.innerHTML and see that the line break is indeed there.

    4.Anything HTML specific will be rendered HTML specific, so you will have to escape < and > into < and > for instance.

    5.document is an object available in browsers, it is not used in node since the DOM doesn't exist there. require("sys"); and use sys.print in nodejs.

提交回复
热议问题