1

我有 2 种不同的方法来创建与 Jquery 的对话框

这个不行:

 var options = "{width: 1024, height: 600, modal: true, buttons: { Cancelar: function () { $(this).dialog('close'); } }, draggable: false, resizeble: false}";

$('#UserSettings').dialog(options);

这个工作正常:

$('#UserSettings').dialog({ width: 1024, height: 600, modal: true, buttons: { Cancelar: function () { $(this).dialog('close'); } }, draggable: false, resizeble: false });

想不通为什么。

4

1 回答 1

5

删除第一个选项中的引号。对话框的参数是一个对象而不是字符串。

var options = {  
        width: 1024, 
        height: 600, 
        modal: true, 
        buttons: { 
           Cancelar: function () { 
              $(this).dialog('close'); 
           } 
        },
        draggable: false, 
        resizeble: false
 };
于 2012-11-15T20:03:47.153 回答