我正在尝试使用style.cssText通过javascript显示隐藏的段落。下面是我的代码:
html:
<p class="toy-pictures-latest">Latest Toy Pictures</p>
<p class="toy-pictures-greatest">Greatest Toy Pictures</p>css:
.toy-pictures-latest{
display: none;
}
.toy-pictures-greatest{
display: none;
}js:
toy-pictures-latest.style.cssText = 'display: inline;';我也试过
document.getElementById("toy-pictures-latest").style.cssText = 'display: inline;';请参阅代码:Codepen
请让我知道我应该如何处理这个问题。
发布于 2020-09-12 19:02:46
js:
document.getElementById("toy-pictures-latest").style.display = "inline";html:
<p id="toy-pictures-latest">Latest Toy Pictures</p>css:
#toy-pictures-latest{
display: none;
}https://stackoverflow.com/questions/63859321
复制相似问题