2011-10-14 79 views
0

我收到一个错误:'share'不是'ASP.default2_aspx'的成员。
OnClick的Button1,我需要这个数据TxtLocation,TxtDistance,日期在Facebook上分享。它非常类似于“与朋友一起运行应用程序”与“运行与朋友应用程序一样模拟”。所以有可能使用fb.ui stream_publish方法,通过点击Button1和所有三个文本框vales。 这是我在Default.aspx的Facebook Javascript SDK分享到Facebook墙

  //stream publish method 
      function streamPublish(name, description, hrefTitle, hrefLink, userPrompt) { 
       FB.ui(
       { 
        method: 'stream.publish', 
        message: '', 
        attachment: { 
         name: name, 
         caption: '', 
         description: (description), 
         href: hrefLink 
        }, 
        action_links: [ 
         { text: hrefTitle, href: hrefLink } 
        ], 
        user_prompt_message: userPrompt 
       }, 
       function (response) { 

       }); 

      } 


      function share() { 
       var share = { 
        method: 'stream.share', 
        u: 'http://thinkdiff.net/' 
       }; 

       FB.ui(share, function (response) { console.log(response); }); 
      } 


     </script> 


     <p><fb:login-button autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button></p> 

    <form id = "form1" runat="server"> 

    <div id="Event" runat="server"> 
     <h1> 
      Add your event</h1> 
     <table> 
      <tr> 
       <td> 
        Where did you go 
       </td> 
       <td> 
        <asp:TextBox ID="TxtLocation" runat="server"></asp:TextBox> 
       </td> 
      </tr> 
      <tr> 
       <td> 
        Number of miles 
       </td> 
       <td> 
        <asp:TextBox ID="TxtDistance" runat="server"></asp:TextBox> 
       </td> 
      </tr> 
      <tr> 
       <td> 
        Date(MM/DD/YYYY) 
       </td> 
       <td> 
        <asp:TextBox ID="TxtDate" runat="server">TxtDate</asp:TextBox> 
       </td> 
      </tr> 
      <tr> 
       <td colspan="2"> 
        <asp:Button ID="Button1" runat="server" Text="Add Distance" onclick="share();return false" BackColor="Blue" /> 
       </td> 
      </tr> 
     </table> 
    </div> 
    </form> 
</body> 
</html> 

回答

0

也许是因为份额已经是函数的名称。

尝试更改函数共享内var的名称。

再见;)