2009-09-19 10 views
0

Quelqu'un peut-il nous dire comment appeler une fonction avec des paramètres sur une boîte de dialogue et appeler cette même fonction d'ailleurs aussi.jquery bouton de dialogue

function showEditDialog(TagDivId, id, type, bFlag) 

{{ essayer 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); 
      } 
    } 

Est-il ok la façon im appeler showEditDialogOkFunc (id) et puis-je appeler cette fonction de partout else.Since il est une fonction de dialogue, il se . tous les properies de la boîte de dialogue définie au-dessus du function.And ok si j'appelle la fonction OK de anuwhere autre sera-il obtenir toutes les propriétés de la boîte de dialogue o non de Grâce

Répondre

0

essayer cet exemple:

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) } 
    ... 

} 
Questions connexes