更新时间:2023-11-28 08:05:34
document.write很邪恶,请不要使用它.
document.write is evil, don't use it.
如果它是静态页面(您的网站似乎是静态页面),则只需将iframe添加到您想要的HTML正文中即可.
If it's a static page (which your site seems to be) then just add the iframe in the body of the HTML where you want it.
如果您确实要在JS中添加按钮客户端,请使用JS SDK( https: //developers.facebook.com/docs/reference/javascript ),然后添加按钮,如下所示:
If you really want to add the button client side in JS, use the JS SDK ( https://developers.facebook.com/docs/reference/javascript ) and add the button like so:
var dynLike = document.createElement('fb:like');
dynLike.setAttribute('href', myEncodedURL);
dynLike.setAttribute('send', 'false');
dynLike.setAttribute('width', '450');
dynLike.setAttribute('show_faces', 'false');
document.body.appendChild(dynLike); // Or wherever you want it
FB.XFBML.parse();