我们已经尝试了一切,但无法让它发挥作用。我们已经放弃了。以下是我们一直使用的代码:
<div id="fb-root"></div>
<script>
(function(d) {
var js, id = 'facebook-jssdk';
if (d.getElementById(id)) { return; }
js = d.createElement('script');
js.id = id;
js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<div class="fb-like-box"
datahref="https://www.facebook.com/pages/Athens-Dental-Center/104463542954148"
data-width="292"
data-show-faces="false"
data-stream="false"
data-header="false">
</div>
现在,问题出在这里:这正是我们在网站上看到的;没有像按钮,只是代码。我怎么解决这个问题?
答案 0 :(得分:1)
datahref
应该是data-href
。 HTML代码是HTML代码,没有任何东西可以打破这个。确保没有<
&amp;代码中的>
您的代码看起来像
<span class="tag"><font color="#800000"><div</font></span><span class="pln"> </span><span class="atn"><font color="#ff0000">id</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"fb-root"</font></span><span class="tag"><font color="#800000">></div></font></span><span class="pln"> <br />
 <br />
</span><span class="tag"><font color="#800000"><script></font></span><span class="pln"> <br />
    </span><span class="pun">(</span><span class="kwd"><font color="#00008b">function</font></span><span class="pun">(</span><span class="pln">d</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> <br />
        </span><span class="kwd"><font color="#00008b">var</font></span><span class="pln"> js</span><span class="pun">,</span><span class="pln"> id </span><span class="pun">=</span><span class="pln"> </span><span class="str"><font color="#800000">'facebook-jssdk'</font></span><span class="pun">;</span><span class="pln"> <br />
        </span><span class="kwd"><font color="#00008b">if</font></span><span class="pln"> </span><span class="pun">(</span><span class="pln">d</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="pln">id</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd"><font color="#00008b">return</font></span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> <br />
        js </span><span class="pun">=</span><span class="pln"> d</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str"><font color="#800000">'script'</font></span><span class="pun">);</span><span class="pln"> <br />
        js</span><span class="pun">.</span><span class="pln">id </span><span class="pun">=</span><span class="pln"> id</span><span class="pun">;</span><span class="pln"> <br />
        js</span><span class="pun">.</span><span class="pln">async </span><span class="pun">=</span><span class="pln"> </span><span class="kwd"><font color="#00008b">true</font></span><span class="pun">;</span><span class="pln"> <br />
        js</span><span class="pun">.</span><span class="pln">src </span><span class="pun">=</span><span class="pln"> </span><span class="str"><font color="#800000">"//connect.facebook.net/en_US/all.js#xfbml=1"</font></span><span class="pun">;</span><span class="pln"> <br />
        d</span><span class="pun">.</span><span class="pln">getElementsByTagName</span><span class="pun">(</span><span class="str"><font color="#800000">'head'</font></span><span class="pun">)[</span><span class="lit"><font color="#800000">0</font></span><span class="pun">].</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">js</span><span class="pun">);</span><span class="pln"> <br />
    </span><span class="pun">}(</span><span class="pln">document</span><span class="pun">));</span><span class="pln"> <br />
</span><span class="tag"><font color="#800000"></script></font></span><span class="pln"> <br />
 <br />
</span><span class="tag"><font color="#800000"><div</font></span><span class="pln"> </span><span class="atn"><font color="#ff0000">class</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"fb-like-box"</font></span><span class="pln">  <br />
    </span><span class="atn"><font color="#ff0000">data-href</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"https://www.facebook.com/pages/Athens-Dental-Center/104463542954148"</font></span><span class="pln"> <br />
    </span><span class="atn"><font color="#ff0000">data-width</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"292"</font></span><span class="pln"> <br />
    </span><span class="atn"><font color="#ff0000">data-show-faces</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"false"</font></span><span class="pln"> <br />
    </span><span class="atn"><font color="#ff0000">data-stream</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"false"</font></span><span class="pln"> <br />
    </span><span class="atn"><font color="#ff0000">data-header</font></span><span class="pun">=</span><span class="atv"><font color="#0000ff">"false"</font></span><span class="tag"><font color="#800000">></font></span><span class="pln"> <br />
</span><span class="tag"><font color="#800000"></div></font></span><span class="pln"> <br />
</span></strong></em></font></font></font></font></span></font></td>
所以你可能正在使用一些代码美化器或其他使代码着色的函数。