English 中文(简体)
• 如何改变碎片的内容:以动态方式使用 Java字?
原标题:How to modify the content of fb:request-form dynamically using Javascript?

I would like to customize my request-form content using javascript. Say i have this in my html...

<div id="invite">
<fb:serverfbml style="width: 600px; height: 650px;">
    <script type="text/fbml">
        <fb:request-form 
            action="index.php"
            method="POST"
            invite="true"
            type="MyApp"
            content="Please have a look at my new __DYNAMICNAME_HERE__. 
                <fb:req-choice url= http://apps.facebook.com/myapp/  label= View Now!  />" >

            <div class="clearfix" style="padding-bottom: 10px;">
                <fb:multi-friend-selector condensed="true" style="width: 600px;" />
            </div>
            <fb:request-form-submit /></fb:request-form>
    </script>
</fb:serverfbml></div>

我愿通过 Java言,积极改变——德国女农民协会。

这里是我所尝试的事情。

function technique1()
{
   var elem = document.getElementById("invite");
   elem.innerHtml = elem.innerHTML.replace("__DYNAMICNAME_HERE__", "MyName");
   // show div code...

   // result is, the current page get s re-rendered inside the div, instead of the FB controls.
}

function technique2()
{
   // Delete all code inside the div... then construct the content using javascript.

   var elem = document.getElementById("invite");
   elem.innerHtml = text;// text is the div innerHtml code constructed at runtime.

   // run show div code
   // result is nothing shows.
}

function technique3()
{
   // First, we remove all code from the div
   // put them into another php page called invite.php

   var elem = document.getElementById("invite");
   elem.innerHtml = "<iFrame src="www.myserver.com/invite.php?name=myname"></iFrame>";

   // run show div code
   // It works but requires 1 more request to the server.
}

是否有任何人知道对服务器(邀请.php)没有额外要求的技术? 可能涉及 FB.XFBML.Host.add 内容、复习......

Btw,i m , 采用谷歌关闭, 处理 handle。

感谢。

问题回答

I also came across the same problem and solved it the way that teepark suggested. I could not change the HTML of facebook s tags because they render in an iframe. MY page is in www.____.com and the iframe is in www.facebook.com. I can t change the contents in that iframe because of cross domain policies.

如今,它实际上试图允许这种操纵。 不过,你可以做的一件事是:重试,其中多数是“带”;四、四、四、四、四、四、一面“显示:无”,然后用 j印显示。

这是一种有限的解决办法,因为它给你带来了有限的选择,必须在时间上加以确定,但是,一旦发现,AFAIK,你就能够从属地获得。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签