“显示” Facebook Facebook:dialog

发布于 2024-08-23 15:11:14 字数 279 浏览 2 评论 0原文

我想使用 facebook 的 fb:dialog 标签来显示一个简单的弹出表单供用户填写。但我想使用 javascript 显示该对话框(在 ajax 请求的 ondone 处理程序中)。

这可能吗?我在黑暗中尝试了一下 document.getElementById('dialog_id').show() 但 show() 不是一种方法。

或者还有 FBJS Dialog 类,但据我所知,您只能使用它来创建简单的警报/确认样式对话框。如果有人知道一种在其中添加任意内容的方法,那么这也可能会解决我的问题。

i want to use facebook's fb:dialog tag to display a simple pop-up form for the user to fill in. but i want to show that dialog using javascript (in the ondone handler of an ajax request).

is this possible? i took a stab in the dark and tried document.getElementById('dialog_id').show() but show() is not a method.

alternatively there is the FBJS Dialog class but as far as i can tell you can only use it to create simple alert/confirm style dialogs. if someone knows of a way to put arbitrary content in them then that may also solve my problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浮世清欢 2024-08-30 15:11:14

您可以将任意内容放入 FBJS 对话框中。

首先,将一些任意的 fbml 存储在 fb:js-string 标记中:

<fb:js-string var="whatever">
<!-- HTML/fbml here -->
</fb:js-string>

然后在 fbjs 中执行以下操作:

(new Dialog()).showMessage('title',whatever); 

You can put arbritrary content inside of an FBJS dialog box.

First, store some arbitrary fbml in an fb:js-string tag:

<fb:js-string var="whatever">
<!-- HTML/fbml here -->
</fb:js-string>

then in fbjs do:

(new Dialog()).showMessage('title',whatever); 
陌路黄昏 2024-08-30 15:11:14

想通了。

埋在 http://wiki.developers.facebook.com/index.html 中。 php/FBJS/Examples/Dialogs 就是答案。

基本上,您使用表单内容创建一个 元素,然后使用 showChoice() 方法将该字符串指定为对话框的内容。

这是相关的例子:

<a href="#" id="dialog_body" onclick="var dialog = new Dialog().showChoice('Important Dialog', dialog_color, 'Okay', 'Nevermind');
dialog.onconfirm = function() {
  var color = document.getElementById('dialog_color_select').getValue();
  document.getElementById('dialog_body').setStyle({background: color});
};
return false;">
A dialog that changes your colors...</a><br />

<fb:js-string var="dialog_color">
<b>What color would you like this set to be?</b><br />
<select id="dialog_color_select">
<option value="transparent">Default</option>
<option value="blue">Blue</option>
<option value="red">Red</option>
<option value="yellow">Yellow</option>
</select>
</fb:js-string>

figured it out.

buried in http://wiki.developers.facebook.com/index.php/FBJS/Examples/Dialogs is the answer.

basically you create a <fb:js-string> element with your form contents and then specify that string as the contents of the Dialog with the showChoice() method.

here is the relevant example:

<a href="#" id="dialog_body" onclick="var dialog = new Dialog().showChoice('Important Dialog', dialog_color, 'Okay', 'Nevermind');
dialog.onconfirm = function() {
  var color = document.getElementById('dialog_color_select').getValue();
  document.getElementById('dialog_body').setStyle({background: color});
};
return false;">
A dialog that changes your colors...</a><br />

<fb:js-string var="dialog_color">
<b>What color would you like this set to be?</b><br />
<select id="dialog_color_select">
<option value="transparent">Default</option>
<option value="blue">Blue</option>
<option value="red">Red</option>
<option value="yellow">Yellow</option>
</select>
</fb:js-string>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文