【发布时间】:2014-12-29 22:07:40
【问题描述】:
这适用于 Firefox,但在 Chrome 上,我在“function onDialogOpen() { this.iframe.css({”) 上收到“Uncaught TypeError: Cannot read property 'css' of null”错误。
function show(options) {
// create our temporary iframe
this.iframe = $('<iframe name="' + (this.id = 'emh_' + +new Date) + '">')
.load($.proxy(onIframeLoad, this));
// show our dialog
this.iframe.dialog($.extend(true, {
title: 'Entity Viewer',
modal: true,
draggable: false,
resizable: false,
width: 800,
height: 500,
buttons: {
'Save & Continue': $.proxy(submitIframeForm, this)
},
open: $.proxy(onDialogOpen, this),
close: $.proxy(onDialogClose, this)
}, options));
alert(options.path);
// since our dialog is showing now, let's update the src of the iframe
this.iframe.attr('src', options.path + '?modal=true&unique=' + this.id);
}
function onDialogOpen() {
this.iframe
.css({
width: '100%',
padding: 0,
border: 0,
margin: 0
});
}
【问题讨论】:
标签: javascript jquery css google-chrome iframe