Cant get "like" button to work on my website
We have tried everything and can't get this to work. We have offically given up. Here is the code we have been using:
<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-lik开发者_JAVA技巧e-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>
Now, here is the problem: this is exactly what we see on the website; no like button, just the code. How might I resolve this?
datahref
should be data-href
instead. HTML code is HTML code and there's nothing that could break this. Be sure there are no <
& >
in your code
EDIT:
Your code looks like
<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>
so you're probably using some code beautifier or another function which colorize your code.
精彩评论