简体   繁体   English

可点击的JavaScript

[英]Clickable JavaScript

I'm using the @anywhere Twitter login to connect to my app. 我正在使用@anywhere Twitter登录名连接到我的应用程序。 It is a JavaScript function and when you click it, it authorizes and then brings the user to the profile page. 它是一个JavaScript函数,当您单击它时,它会授权用户,然后将其带到个人资料页面。 I'm using the Tutorial here for the button. 我在这里使用教程按钮。 I'm not even sure how it could be clickable. 我什至不确定如何点击它。 This is the code that I have in place: 这是我已有的代码:

<span id="login"></span>

<script type="text/javascript">



  twttr.anywhere(function (T) {

    T("#login").connectButton({ 

      authComplete: function(user) {

        // triggered when auth completed successfully

      },

      signOut: function() {

        // triggered when user logs out

      }

    });

  });


</script>

I was thinking of an <a href="foo" </a> for it but I don't know how it would work. 我当时在想<a href="foo" </a> ,但是我不知道它如何工作。 Thanks! 谢谢!

Make sure you have the twitter script in the header of the HTML: 确保HTML标题中包含twitter脚本:

<head>
  ...
  <script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&v=1" type="text/javascript"></script>
</head>

Then it should work - Just make sure that the thing in T("#login") matches your id in the span. 然后就可以了-只需确保T(“#login”)中的内容与您的ID在范围内匹配即可。

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

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