0

我在我的粉丝页面上的 Facebook iframe 选项卡上进行了一项民意调查。我想制作像 facebook.com/buddymedia 这样的功能。如果用户单击提交按钮,则将显示投票结果并同时出现提要对话框。

我尝试了这段代码,但没有奏效: onclick="(return onVote(), function jsuipopup();)"

此处的提要对话框脚本:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({ 
    appId:'195xxxxxxxxxxxx417', cookie:true, 
    status:true, xfbml:true 
 });
function jsuipopup(){

    FB.ui({
        method: 'feed',
        message: ' msg here',
        name: 'name here!',
        caption: 'captn here',
        description: ( descriptn here' ),
        link: 'http://www.facebook.com/pages/mypage',
        picture: 'http://mysite.com/img/logo.png',
        actions: [{
            name: 'vote it', 
            link: 'http://www.facebook.com/pages/mypage'
        }],
        user_message_prompt: 'wright msg'
    });
}
</script>

只工作一种功能而不是两种。如何使两个功能同时工作?

4

2 回答 2

1

这还不够吗:

onclick="return onVote(), jsuipopup(), false;"

活生生的例子

于 2011-04-14T13:45:24.793 回答
0

您的代码在 onVote() 执行后退出,因此永远不会到达 jsuipopup()。

尝试从这里改变:

onclick="(return onVote(), function jsuipopup();)"

对此:

onclick="jsuipopup(); return onVote();"

尽管为了清楚起见,将函数定义设置为可以引用的变量可能更有意义:

var voteAndStuff = function() { 
   jsuipopup(); 
   return onVote();
}

然后就这样称呼它:

onclick="return voteAndStuff();"
于 2011-04-14T10:13:24.313 回答