0
這就是我設置我的登錄/註冊流程的方式。在index.html頁面上有一個鏈接。點擊後,您將被髮送到第二頁,在該頁面中您的登錄狀態將被檢查,並且如果您未註冊或登錄,將顯示fb登錄/註冊框。 我所做的是使標籤在頁面上不可見直到檢查登錄狀態之後?一旦檢查,我希望它變得可見,如果用戶沒有登錄或註冊,但它不可見。 在登錄狀態被選中之前,隱藏註冊/登錄框可見性的最佳方法是什麼?我不想使用facebooks login()函數,因爲我不想彈出一個窗口。我想使用XFBML標籤。以下是我的代碼:如何從裏面改變fb:註冊標籤的可見性getLoginStatus()函數
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script >
<base href="http://spilot.koding.com/">
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
// Additional JS functions here
window.fbAsyncInit = function() {
FB.init({
appId : '3967205****88', // App ID
channelUrl : '//http://spilot.koding.com/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// get login status
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// connected
} else if (response.status === 'not_authorized') {
// not_authorized
document.getElementByName("login").style.visibility = visible;
} else {
// not_logged_in
document.getElementByName("login").style.visibility = visible;
}
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
<div id="fb-root" name="login" style="visibility:hidden">
<script src="https://connect.facebook.net/en_US/all.js#appId=396720557089188&xfbml=1"></script>
<fb:registration
fields="name,birthday,gender,location,email"
redirect-uri="http://spilot.koding.com/signedRequest.php" width="530">
</fb:registration>
</div>
</body>
</html>
「fb-root」的結束標記在哪裏?另外爲什麼不把另一個div包含在'fb:registration'標籤中並顯示/隱藏那個標籤? – 2013-03-07 19:36:47