我刚刚为我的博客添加了一个类似按钮,首先它不起作用,但现在确实如此,但它显示在我创建的所有页面上,包括联系页面http://scheissemag.blogspot.com/p/contact.html ,这困扰我,我想隐藏它或删除div。 对于按钮的代码,我用这一个:(我<div class='post-footer-line post-footer-line2'/>
后装)删除Blogger上联系人页面上的Facebook Like按钮
<div>
<div id='fb-root'/>
<script>
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/fr_FR/all.js#xfbml=1';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<fb:like action='like' colorscheme='light' expr:href='data:post.url' font='arial' layout='standard' send='false' show_faces='false'/> </div>
我试着用我在这个网站上找到搜索后的代码删除:
<div id="fr-root"> (I tired LikeDiv too)
my div
</div>
<script>
{
// Remove the element from the dom
var Node1 = document.getElementById('likeDiv');
Node1.removeChild(Node1.childNodes[0]);
}
</script>
但它总是在那里!
在你的第二个示例中,div id是'fr-root',但是你将'likeDiv'传递给'getElementById'。在这篇文章中输错,或者在你的代码中输入错误(这可以解释失败)? – tomlogic