0

我想制作一个带有表单字段的 facebook 页面选项卡,访问者可以在其中填写一个值,然后按发布到墙按钮,该值将用于 fb.ui 发布到墙功能的名称值。

有人可以指出我正确的方向吗?

这是我用来贴到墙上的。

<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
  FB.init({appId: <APPID>,
              status: true,
              cookie: true,  
              xfbml: true});  };  
     (function() {
         var e = document.createElement('script');
         e.async = true;  
         e.src = document.location.protocol +  
         '//connect.facebook.net/en_US/all.js';
         document.getElementById('fb-root').appendChild(e);
     }());
 </script>

<script>
function publish_to_wall(){
   FB.ui({ 
     method: 'stream.publish',
     display: 'iframe',
     name: '<VALUE TO RETRIEVE FROM FORMFIELD> blablablalba',
     caption: '<TEXT>',
     link: 'http://www.facebook.com/<MYPAGE>',
     picture:'<IMAGE URL>'
   });
 }
</script>

要查看选项卡,您可以在此处查看:http: //www.sociallogika.com/tabs/hp/index.html

现在表单域仍然是一个图像,共享按钮还没有激活......但它让你更好地了解我的意思......

Button 应该直接启动弹出对话框。

4

1 回答 1

0

给表单一个id...然后使用 document.getElementById("theID").value ,虽然不是真正的facebook问题...

干杯

扩展示例:

<input type='text' id='myText' />


<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
  FB.init({appId: <APPID>,
              status: true,
              cookie: true,  
              xfbml: true});  };  
     (function() {
         var e = document.createElement('script');
         e.async = true;  
         e.src = document.location.protocol +  
         '//connect.facebook.net/en_US/all.js';
         document.getElementById('fb-root').appendChild(e);
     }());
 </script>

<script>
function publish_to_wall(){
   FB.ui({ 
     method: 'stream.publish',
     display: 'iframe',
     name: document.getElementById('myText').value,
     caption: '<TEXT>',
     link: 'http://www.facebook.com/<MYPAGE>',
     picture:'<IMAGE URL>'
   });
 }
</script>
于 2012-01-04T12:57:40.837 回答