如何实现Facebook“Like”按钮为我的网站 [英] How to implement the Facebook "Like" button for my website

查看:270
本文介绍了如何实现Facebook“Like”按钮为我的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上实现Facebook的按钮。
代码中的前四行已经在我的站点上,在标签结束之后。



为了实现Like按钮,我添加了第二个脚本(第五行到最后)
并运行应用程序。它给我一个错误



Microsoft Jscript运行时错误:'_ onLoad'为null或不是对象



请让我知道。谢谢

 < script type =text / javascriptsrc =http://static.ak.connect.facebook。 COM / JS / api_lib / V0.4 / FeatureLoader.js.php>< /脚本> 
< script type =text / javascript>
FB.init(myapikey,xd_receiver.htm,{reloadIfSessionStateChanged:true});
< / script>
< script type =text / javascript>
window.fbAsyncInit = function(){
FB.init({appId:'myappid',status:true,cookie:true,
xfbml:true});
};
(function(){
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
' //connect.facebook.net/en_US/all.js';
document.getElementById('fb-root')。appendChild(e);
}());
< / script>

参考文献:
http://developers.facebook.com/docs/reference/plugins/like

 < fb:like href =http://webclip.inlayout =standardshow-faces =truewidth =450action =likefont = arialcolorscheme =light/> 


解决方案

有一种新的方式在您的网站上添加相似的按钮。



转到此页面,
http://developers.facebook.com/docs/reference/plugins/like-box



并通过放大参数创建代码,然后单击获取代码



这是一个例子

 < iframe 
src =http://www.facebook.com/plugins/likebox.php?id=185550966885&amp;width=292&amp; connections = 10& amp; amp; amp; amp; amp; amp = amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp ; width:292px; height:587px; ALLOWTRANSPARENCY = 真 >
< / iframe>

或只是(如果您使用的是Facebook的JavaScript SDK)

 < fb:like-box profile_id =185550966885>< / fb:like-box> 

另外在页面
http://developers.facebook.com/docs/reference/plugins/like
有一个获取代码...这些工作,不需要在你的代码上添加这个javascript。


I am trying to implement facebook like button on my website. The first four lines in the code is already there on my site after the end of the "" tag.

To implement the "Like button" i have added the second script (Line five to the end) and ran the application. Its giving me an error as

"Microsoft Jscript runtime error:'_onLoad' is null or not an object"

Please Let me know. Thanks

<script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"></script>
<script type="text/javascript">
    FB.init("myapikey", "xd_receiver.htm", { "reloadIfSessionStateChanged": true });
</script>
<script type="text/javascript">
  window.fbAsyncInit = function() {
    FB.init({appId: 'myappid', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());
</script>

References: http://developers.facebook.com/docs/reference/plugins/like

<fb:like href="http://webclip.in" layout="standard" show-faces="true" width="450" action="like" font="arial" colorscheme="light"/>

解决方案

There is a new way to add the like button on your site.

go to this page, http://developers.facebook.com/docs/reference/plugins/like-box

and create the code by plasing your parametres and click the "Get Code"

This is an example

<iframe 
    src="http://www.facebook.com/plugins/likebox.php?id=185550966885&amp;width=292&amp;connections=10&amp;stream=true&amp;header=true&amp;height=587" 
    scrolling="no" frameborder="0" 
    style="border:none; overflow:hidden; width:292px; height:587px;" allowTransparency="true">
    </iframe>

or just (if you using Javascript SDK of facebook)

<fb:like-box profile_id="185550966885"></fb:like-box>

Also in the page http://developers.facebook.com/docs/reference/plugins/like there is a Get Code... thats works, no need to add this javascript on your code.

这篇关于如何实现Facebook“Like”按钮为我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆