Facebook Javascript SDK分享到Facebook墙

时间:2011-10-14 05:46:49

标签: asp.net facebook

我收到错误:'share'不是'ASP.default2_aspx'的成员。
点击Button1,我需要在Facebook上分享这个数据TxtLocation,TxtDistance,Date。它非常类似于“与朋友一起运行应用程序”模拟与“与朋友应用程序运行”相同的模拟。因此,可以使用fb.ui stream_publish方法单击Button1并使用所有三个文本框值。 这就是我在default.aspx

中的内容
            //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>

1 个答案:

答案 0 :(得分:0)

也许是因为分享已经是该功能的名称。

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

再见;)