0

我试过这个:

<div style="width:52px;overflow:hidden;">
 <fb:like layout="button_count"></fb:like>

 <div id="fb-root"></div>
 <script>
 window.fbAsyncInit = function() {
      FB.init({appId: 'YOUR_APP_ID', status: true, cookie: true,
      xfbml: true});
      };
      (function() {
      var e = document.createElement('script');
      e.type = 'text/javascript';
      e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
      e.async = true;
      document.getElementById('fb-root').appendChild(e);
 }());
 </script>
</div>

它只显示FaceBook的一个like按钮,但不显示有多少人喜欢它。点赞后只显示 facebook 的 V 标志(我喜欢它)。

我如何始终显示总喜欢的数字?

4

2 回答 2

2

阅读此链接

developer.facebook.com/docs/reference/plugins/like

更新

您必须在 Like 插件中选择此选项(见图在此处输入图像描述

于 2012-05-23T06:41:56.767 回答
0

好像您正在使用 XFBML 版本的 Like 按钮。

确保您已将 XML 命名空间定义为 yout html,如下所示。

<html xmlns:fb="http://ogp.me/ns/fb#">

在 body 标记之后定义您的以下代码

<div id="fb-root"></div>
 <script>
 window.fbAsyncInit = function() {
      FB.init({appId: 'YOUR_APP_ID', status: true, cookie: true,
      xfbml: true});
      };
      (function() {
      var e = document.createElement('script');
      e.type = 'text/javascript';
      e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
      e.async = true;
      document.getElementById('fb-root').appendChild(e);
 }());
 </script>

然后在页面上使用您的按钮代码,例如

<div style="width:52px;overflow:hidden;">
<fb:like href="http://www.google.com" send="false" layout="button_count" width="450" show_faces="true"></fb:like>
</div>
于 2012-05-23T06:52:14.640 回答