Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 关闭JQueryUI对话框只工作一次_Javascript_Jquery_Jquery Ui_Iframe - Fatal编程技术网

Javascript 关闭JQueryUI对话框只工作一次

Javascript 关闭JQueryUI对话框只工作一次,javascript,jquery,jquery-ui,iframe,Javascript,Jquery,Jquery Ui,Iframe,我在看这个Answare。 我有相同的情况,即一个页面以这种方式调用jqueryui对话框: var message = '<div id="pickDialog"><iframe frameborder="0" src="/Anagrafica/Pick?where=TipoAnagrafica=\'P\'"></iframe></div>' $(message).dialog({ modal: true,

我在看这个Answare。 我有相同的情况,即一个页面以这种方式调用jqueryui对话框:

var message = '<div id="pickDialog"><iframe frameborder="0" src="/Anagrafica/Pick?where=TipoAnagrafica=\'P\'"></iframe></div>'

    $(message).dialog({
        modal: true,
        width: 'auto',
        title: 'Seleziona'
    });
这个代码可以工作。。。但这只是第一次!当我第二次打开iframe id=“pickDialog”时,当我按下Si按钮时,对话框不会关闭。 closePick函数已经执行,我在Javascript控制台中没有出错。
可能是什么

我已经解决了这个问题,将其放在html页面中

然后jquery函数变成

function pickDialog() {
var message = "<iframe width="100%" height="100%" frameborder="0" src="/Anagrafica/Pick?where=TipoAnagrafica=\'P\'"></iframe>"    

    $("#pickDialog").dialog({
        modal: true,
        width: dWidth,
        height: dHeight,
        title: 'Seleziona'
    }).html(message);
}
函数pickDialog(){
var message=“”
$(“#pickDialog”).dialog({
莫代尔:是的,
宽度:dWidth,
身高:dHeight,
标题:“Seleziona”
}).html(信息);
}
另一个代码保持不变。我不知道为什么,但这解决了问题

function closePick() {
    $('#pickDialog').dialog('close');
    return false;
}
function pickDialog() {
var message = "<iframe width="100%" height="100%" frameborder="0" src="/Anagrafica/Pick?where=TipoAnagrafica=\'P\'"></iframe>"    

    $("#pickDialog").dialog({
        modal: true,
        width: dWidth,
        height: dHeight,
        title: 'Seleziona'
    }).html(message);
}