【问题标题】:jquery dialog buttonjquery对话框按钮
【发布时间】:2009-09-19 09:29:16
【问题描述】:

谁能告诉他们如何在对话框中调用带有参数的函数,并从其他地方调用相同的函数。

function  showEditDialog(TagDivId, id, type, bFlag)

{ 尝试 { stickyinfo = new Array();
jQuery('#'+TagDivId).dialog({

    autoOpen: false,
    height : 535,
    width:320,
    modal: true,
    resizable:false,
    //closeOnEscape:false,

    buttons: {
        Cancel: function() {
            jQuery(this).dialog('close');
        },
        'OK': function showEditDialogOkFunc(id) {
            //stickyinfo.clear();
            //Register Collaboba Tag with the Server.
            var color = jQuery('#' + id).css('background-color');
            var tagid = document.getElementById(id);
            if(tagid != null)
            {
                GetTagInformation(id, stickyinfo); 
            }
            else
            {
                return false;
            }
             }
       }

            catch(e)
            {
           alert(e);
            }
   }

我调用 showEditDialogOkFunc(id) 的方式可以吗?我可以从其他任何地方调用这个函数吗其他地方的函数将不会获得对话框的所有属性。 谢谢

【问题讨论】:

    标签: jquery button dialog


    【解决方案1】:

    试试这个例子:

    function showEditDialogOkFunc(opcions)
    {
        alert(opcions.id + " " + opcions.stickyinfo);
    }
    
    
    function  showEditDialog(TagDivId, id, type, bFlag) {
    
      var options = {
         id:id,
         stickyinfo: new Array()
      }
      var pthis = this;
    
      ...
      'OK': function () { showEditDialogOkFunc.call(pthis, options) }
      ...
    
    }
    

    【讨论】:

      猜你喜欢
      • 2013-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-20
      • 2010-10-31
      相关资源
      最近更新 更多