0

カスタム パラメーターを jQuery UI 確認ダイアログに渡すことで、アプリケーションのどこからでも呼び出すことができる汎用関数を作成しようとしています。私はさまざまなことを検索して試してきましたが、使用したいロジックは次のとおりです。私は何を間違っていますか?どんな助けでも大歓迎です。

関数は次のとおりです。

function popDialog(h, w, deny_btn, confirm_btn, confirm_title, confirm_message, deny_action, confirm_action) {
  var newDialog = $('<div id="dialog-confirm">\
      <p>\
        <span class="ui-icon ui-icon-alert" style="float: left;margin: 0 7px 60px 0;"></span>\
        ' + confirm_message + '\
      </p>\
    </div>');
  newDialog.dialog({
    resizable: false,
    height: h,
    width: w,
    modal: true,
    autoOpen:false,
    title: confirm_title,
    buttons: [
      {text: deny_btn: click: function() {deny_action}},
      {text: confirm_btn: click: function() {confirm_action}}
    ]
  });

}

呼び出しは次のとおりです。

$("#cancel").click(function(e) {
    popDialog("210", // height
              "350", // width
              "No",  // deny_btn
              "Yes", // confirm_btn
              "Confirm Cancel", // confirm_title
              "Are you sure you would like to cancel? Changes will not be saved.", // confirm_message
              $('#dialog-confirm').dialog('close'), // deny_action
              window.location = '/some/location/index/<?= $class->getClassid() ?>'); //confirm_action


});
4

3 に答える 3

0

複数行の問題を説明するだけです(コメントはできませんが、回答はできます):

var bad = 'Invalid
syntax';

--

var good = 'Valid' +
'syntax';
于 2013-10-09T19:14:28.963 に答える