繁体   English   中英

使用其他按钮Javascript触发fb:login-button

[英]Trigger fb:login-button with other button Javascript

我想触发fb:login-button

<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>

第二个按钮。 为什么? 我无法调整Facebook的CSS,我想使用带有自定义图片的精美按钮替换它。 我的大问题是我不知道FB按钮的ID是什么,我不能给它一个。

我的错误代码:

<script>
    function Ffirst()
    {
    alert("first");
    $("fb:login-button").click(); 
    //$("fb:login-button").trigger("click"); //doesn't work eiter
    }
</script>

<input type="submit" onclick="Ffirst()" name="savebutton" id="first" />
<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>

FTR:这就是我按the fb:login-button时发生的情况

FB.Event.subscribe('auth.authResponseChange', function(response) {
    // Here we specify what we do with the response anytime this event occurs. 
    if (response.status === 'connected') {
          testAPI();
    }

    } else if (response.status === 'not_authorized') {
      FB.login();

    } else {
          FB.login();
    }
  });

  // 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));

@Lix在代码中的答案:

<input type="submit" onclick="FB.login()"/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM