gpt4 book ai didi

javascript - 在 JavaScript 字符串中输入换行符的正确语法是什么?

转载 作者:行者123 更新时间:2023-11-28 16:02:30 24 4
gpt4 key购买 nike

在字符串中插入换行符的正确语法是什么?我已经尝试过 '\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/

24 4 0
文章推荐: javascript - 更改列表和循环中的元素类
文章推荐: javascript - jQuery 选择器无法与下拉菜单一起正常工作
文章推荐: html - 如何定位 中的第一个 ,而不是
中的第一个