2011-04-13 122 views
0

我在我的粉丝页上的Facebook iframe选项卡上进行了一项民意调查。我想制作像这里的功能facebook.com/buddymedia。如果用户单击提交按钮,则轮询结果将显示,同时会显示进纸对话框。如何在1粉丝进入Facebook粉丝页面时进行2个动作?

我想这个代码,但没有奏效: 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> 

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

回答

0

你的代码在onVote()执行后退出,所以jsuipopup()永远不会到达。

尝试从这个变化:

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

要这样:

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

虽然为清楚起见,可能更有意义,具有的功能定义设置为变量,你可以参考:

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

然后就这样调用它:

onclick="return voteAndStuff();" 
1

不应该这样已经足够了:

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

Live example