Hul*_*ulk 4 jquery jquery-ui jquery-plugins jquery-dialog
有一个页面作为transaction.html
如何在另一个页面的弹出窗口中打开此页面,在jquery对话框中说show_transactions.html
$dialog.html() //open transaction.html in this dialog
.dialog({
autoOpen: true,
position: 'center' ,
title: 'EDIT',
draggable: false,
width : 300,
height : 40,
resizable : false,
modal : true,
});
alert('here');
$dialog.dialog('open');
Run Code Online (Sandbox Code Playgroud)
此代码存在于show_transactions.html中
谢谢..
Zac*_*ack 15
您可以使用jQuery的.load()方法将页面加载到对话框中,具体如下:
$("#dialog").dialog({
autoOpen: false,
position: 'center' ,
title: 'EDIT',
draggable: false,
width : 300,
height : 40,
resizable : false,
modal : true,
});
$("#dialog_trigger").click( function() {
$("#dialog").load('path/to/file.html', function() {
$("#dialog").dialog("open");
});
})
Run Code Online (Sandbox Code Playgroud)
这假定对话框的ID为'dialog',并且还有另一个ID为'dialog_trigger'的元素被单击以打开它.您将这两个文件放入文档的就绪函数中,以便在页面加载时进行对话,如果不是,则会对用户造成轻微但明显的延迟.