繁体   English   中英

Facebook Javascript SDK分享到Facebook Wall

[英]Facebook Javascript SDK share to facebook wall

我收到一个错误:“ share”不是“ ASP.default2_aspx”的成员。
在Button1的OnClick上,我需要此数据TxtLocation,TxtDistance,Date在Facebook上共享。 它与“与朋友运行应用程序”非常相似,与“与朋友运行应用程序”相同。 因此,可以在单击Button1的同时使用fb.ui stream_publish方法和所有三个文本框值。 这是我在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>

也许是因为共享已经是函数的名称。

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

再见;)

暂无
暂无

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

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