0

複数行のメッセージを含む FBJS ダイアログを表示しようとしています。

message += "Please enter the name of the Post.\n"
message += "Please enter content.\n"
message += "Content must have at least 10 characters.";

new Dialog().showMessage("Error", message);

しかし、そのコードはメッセージを同じ行に表示します。

誰もそれを行う方法を知っていますか?

ありがとう。エルネスト・カリオン

4

1 に答える 1

1

テキスト以外のものをダイアログに表示する場合は、fb:js-string を使用する必要があります。

次に例を示します。

<fb:js-string var="messageToShow">
  Here's some text.<br />
  and some more text...<br />
  <p>You can even have HTML or FBML tags in here!</p>
  <img src="http://absolute.path.to/the/image.jpg" />
  <form id="selectFriendForm">
    <label class="RedLabel">Select a friend:</label>
    <fb:friend-selector name="uid" idname="selected_friend" />
  </form>
</fb:js-string>

そして、ダイアログを表示する関数があります:

<script type="text/javascript">
  function showDialog() {
    var dialog = new Dialog(Dialog.DIALOG_POP);
        dialog.showChoice('Select a friend',
        messageToShow, // fb:js-string var name
        button_confirm = 'Choose this friend',
        button_cancel = 'Cancel'
      );

    dialog.onconfirm = function() {
      var formData = document.getElementById('selectFriendForm').serialize();
      // ajax call to save my selected friend or whatever
    }
  }
</script>
于 2010-08-02T20:09:30.007 に答える