无法运行.js文件中的函数

时间:2017-06-21 04:47:32

标签: javascript

我知道我应该能够运行这个功能

function fba(){
    FB.login(function(response) {
            if (response.authResponse) {
             console.log('Welcome!  Fetching your information.... ');
             FB.api('/me', function(response) {
               console.log('Good to see you, ' + response.name + '.');
             });
            } else {
             console.log('User cancelled login or did not fully authorize.');
            }
        }, {scope: 'id,name,gender,is_verified,timezone,picture.width(800)', return_scopes: true});
}

但是因为它像这样包含在页脚中

  <script src="./templates/main/user-theme/javascript/facebook.js"></script>

似乎网站的html部分无法理解onClick="fba();"

     <button class="loginBtn loginBtn--facebook" onClick="fba();">
        Continue with Facebook
      </button>

错误是fba is not defined

0 个答案:

没有答案