How to make 2 actions on 1 onclick into Facebook fan page?
I have a poll on the Facebook iframe tab on my fan page. I want to make the feature like here facebook.com/buddymedia. If user click Submit button then poll results will display and simultaneously feed dialog will appear.
I tried this code but it did not work:
onclick="(return onVote(), function jsuipopup();)"
Script for feed dialog here:
<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({
开发者_C百科 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>
Work only one function not two. how to make two functions work simultaneously?
Shouldn't this be enough:
onclick="return onVote(), jsuipopup(), false;"
Live example.
Your code exits after onVote() executes, so jsuipopup() is never reached.
Try changing from this:
onclick="(return onVote(), function jsuipopup();)"
To this:
onclick="jsuipopup(); return onVote();"
Though for clarity, it may make more sense to have the function definition set to a variable that you can reference:
var voteAndStuff = function() {
jsuipopup();
return onVote();
}
And then just call it like this:
onclick="return voteAndStuff();"
精彩评论