当我将下面的脚本添加到我的Web页面时:
<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文件添加到我的网页中的代码。
发布于 2017-06-15 03:51:56
将脚本放在可以使用CSS作为目标的元素中,并将该元素的<b>设置为display:none;。可选的是,你也可以用.quote-of-the-day b + br隐藏它包含的<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>
这给了你很大的自由去设计你认为合适的样式。例如,bellow内联了作者,并将引用放在一个带样式的块引用中。
.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>
发布于 2017-06-15 03:45:18
选择并删除这段代码。
$("b").each(function() {
$(this).empty(); // $(this).remove();
});更加精挑细选:
$("b").each(function() {
if($(this).text() == "Quote of the Day")
$(this).empty(); // $(this).remove();
}
}); 发布于 2017-06-15 03:50:21
在包含来自BrainyQuote的脚本之后添加以下代码:
<script type="text/javascript">
document.body.innerHTML = document.body.innerHTML.replace("<b>Quote of the Day</b><br>", "");
</script>https://stackoverflow.com/questions/44553400
复制相似问题