【发布时间】:2015-02-16 22:45:26
【问题描述】:
// Use ckeditor created a iframe dom.
var iframe_node = new CKEDITOR.dom.element('iframe');
var iframe_styles = {
'font-size':'inhert',
'z-index':'10030',
'position':'absolute',
'left':'250px',
'top':'50px',
'width':'505px',
'height':'441px'
};
iframe_node.setStyles(iframe_styles);
// Append iframe to cke_dialog
jQuery(iframe_node.$).appendTo('.cke_dialog');
var seciframecon = jQuery('.cke_dialog').find("iframe").contents();
iframe_node = jQuery(iframe_node.$)[0];
console.log(seciframecon.find('html').html());
// I get <head></head><body></body>
seciframecon.find('html').html(htmloutput);
console.log(seciframecon.find('html').html());
我得到我的字符串像
<div class="ctools-modal-content> <div class="modal-header"> <span class="modal-title" id="modal-title" style="font-size:20px;">Format</span> <input value="format_facet" name="selectedfacet" type="hidden"> <a href="#" class="close"><img title="Close window" alt="Close window" src="xxxx" typeof="foaf:Image"> </a> </div> <div class="modal-content" id="modal-content" style="width: 475px; height: 355px;"> <table> <thead> <tr><th style="text-align:center;width:70px;">Include</th> <th style="text-align:center;width:70px;">Exclude</th> <th>Format</th> </tr> </thead> <tbody> <tr class="odd"> <td style="text-align:center;width:70px;"><div>balabalabala ....
这应该可以更改 iframe 内容, 但它在 Firefox 中不起作用!
来自 firebug 的 html 显示如下。
<iframe style="z-index: 10030; position: absolute; left: 250px; top: 50px; width: 505px; height: 441px;">
<html>
<head>
</head>
<body>
</body>
</html>
html 已附加,然后在 firefox 中很快消失
为什么console.log(seciframecon.find('html').html());在seciframecon.find('html').html(htmloutput);之后可以得到字符串,
但 iframe 内容在 firefox 浏览中还是空白?
它在 Chrome 中运行良好。
有什么提示吗?
【问题讨论】:
标签: jquery firefox iframe cross-browser ckeditor