lhgdialog获取父窗口对象的方法

通过

$.dialog({

id: "ai",

title: title,

lock: true,

width: width+'px',

height: height,

content: 'url:'+url

});方法打开窗口后,想在打开的子窗口里调用父窗口的方法,用parent是取不到的,只能用frameElement.api.opener才能取到。

 

$.dialog({

id: "ai",

title: title,

lock: true,

width: width+'px',

height: height,

content: 'url:'+url,

ok: function() {

this.iframe.contentWindow.doSave();

return false;

},

cancel: function() {

this.iframe.contentWindow.doClose();

return false;

},

cancelVal: '关闭'

});

this.iframe.contentWindow用来在父窗口里调用子窗口的方法,return false是阻止默认的关闭事件。

猜你喜欢

转载自flyer0428-qq-com.iteye.com/blog/2330135