簡體   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