- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在字符串中插入换行符的正确语法是什么?我已经尝试过 '\n' 但这不起作用......?这是有问题的字符串:
function layer0(){
document.getElementById('layerinfo').innerHTML = 'The Wembury Quest ran during June 2012 and was very popular in the parish. Over 400 quest packs were collected from the village school post office and local shops. The Quest was designed to encourage residents to go out into the parish and explore their local landscape. This layer shows the results from the letterboxes. For the letterboxes twelve locations were chosen, spread around the parish. They were picked to take participants to very different types of landscape and views. Some of them were places which they had visited before, and some were off the beaten track and were new to some Questers. All of the locations were found on public rights of way.';
最佳答案
\n
是在字符串中插入换行符的正确语法。您的问题是您不想在字符串中插入换行符。您要插入文本 <br>
在一个字符串中。插入文本 <br>
的正确语法字符串中是 <br>
.
关于javascript - 在 JavaScript 字符串中输入换行符的正确语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16450778/
|
我是一名优秀的程序员,十分优秀!