【发布时间】:2020-12-25 13:42:48
【问题描述】:
我创建了一个 Javascript,因此如果我在下面的脚本中添加引号,它应该放在 <p></p>element 中。
const quotes = [
{ quotes: 'Be yourself; everyone else is already taken' },
{ quotes: 'So Many Books, So Little Time' },
{ quotes: "Strangers think I'm Quiet. My Friends think I'm outgoing. My best friends know that I'm Completely Insane" },
{ quotes: 'A room without books is like a body without soul' },
{ quotes: 'You only live once, but if you do it right, once is enough' },
];
function quoteindexer() {
quotesView.innerHTML = quotes[i].quotes;
}
我的html代码
<p class="quotes" id="quoteindexer"></p>
但我需要将所有引号显示在不同的 <p></p> 元素本身中。也就是说,引号的数量应该等于创建的<p></p> 的数量。我是 Javascript 新手,所以请帮助我。
【问题讨论】:
标签: javascript html dom-events dynamic-html