2011-03-23 45 views
0
</html> 
<head> 
</head> 
<body> 
<iframe src="http://www.facebook.com/plugins/like.php?href=http://rgksugan.in/" 
     scrolling="no" frameborder="0" 
     style="border:none; width:450px; height:80px"><iframe> 
<div id="fb-root"></div> 
     <script src="http://connect.facebook.net/en_US/all.js"></script> 
     <script> 
     FB.init({ 
      appId:'194541653919499', cookie:true, 
      status:true, xfbml:true 
     }); 
     </script> 
<fb:login-button>Login with Facebook</fb:login-button> 
</body> 
<html> 

這是我的HTML頁面。我期待在我的頁面中使用Facebook登錄按鈕。但它不出現。問題是什麼?登錄facebook時出現問題

+0

壞的HTML標籤.. – Kon 2011-03-23 02:59:38

回答

1

嗨,你是否嵌入Facebook連接代碼在你的HTML標記?其他的事情你必須同步或異步加載你的jsdk。之後放置像按鈕的代碼。首先讓你的HTML標籤類似這樣的 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en"> ,然後只是你< body>標籤

 
<body> 
window.fbAsyncInit = function() { 
    FB.init({ 
      appId:'194541653919499', cookie:true, 
      status: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> 

使用此代碼對你的喜歡按鈕後,試試這個。你的第三個問題是你的代碼中有兩個Facebook連接語句。當您使用異步方式與Facebook進行連接時,如果您使用按鈕代碼,則不需要重新連接。使用此代碼

 
<fb:like href="http://rgksugan.in/" show_faces="true" width="450" font=""></fb:like> 
1

iframe按鈕的結束標記格式不正確。

變化 <iframe src="http://www.facebook.com/plugins/like.php?href=http://rgksugan.in/" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"><iframe>

<iframe src="http://www.facebook.com/plugins/like.php?href=http://rgksugan.in/" 
    scrolling="no" frameborder="0" 
    style="border:none; width:450px; height:80px"></iframe>