当我将以下脚本添加到我的网页时:
<script type="text/javascript" src="https://www.brainyquote.com/link/quotebr.js"></script>
此脚本在我的网页中添加以下 JavaScript:
var br=document;
br.writeln("<b>Quote of the Day</b><br>");
br.writeln("Many of life's failures are people who did not realize how
close they were to success when they gave up.<br>");
现在我不想在我的网页中显示“每日报价”。我该如何修改它? 如果你打开这个链接https://www.brainyquote.com/link/quotebr.js你可以在我的网页中看到这个 Js 文件添加的代码。
最佳答案
将脚本放在可以用 CSS 定位的元素中并设置 <b>
对于那个元素到display:none;
.可选地,您还可以隐藏 <br>
它也包括 .quote-of-the-day b + br
.
.quote-of-the-day b, .quote-of-the-day b + br {display:none}
<div class="quote-of-the-day">
<script type="text/javascript" src="https://www.brainyquote.com/link/quotebr.js"></script>
</div>
这为您提供了很多您认为合适的样式的自由度。例如,波纹管内联作者并将引用放在样式化的 block 引用中。
.quote-of-the-day b, .quote-of-the-day br {display:none}
.quote-of-the-day {
padding: 1em;
border-left: 4px solid #ddd;
background: #f0f0f0;
margin: 1em;
color: #333;
}
.quote-of-the-day a {
text-decoration: none;
color: #c55;
font-style: italic;
}
.quote-of-the-day a:before {
content: '\00a0\2014\00a0';
color: #333;
cursor: default;
}
<blockquote class="quote-of-the-day">
<script type="text/javascript" src="https://www.brainyquote.com/link/quotebr.js"></script>
</blockquote>
关于javascript - 我在我的网站中添加了在线 JavaScript。如何更改由该 JavaScript 添加的网页中的 HTML?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44553400/