我有下面的代码来打印加载到fancybox中的文本。它在chrome和firefox中运行完美。但在ie9中,它会打开一个空白窗口并关闭。然后什么都不会发生。
jQuery(function($) {
$('a.print').click(function() {
var print_button = '';
var print_page = window.open('', 'Print', 'width=600,scrollbars=yes, height=700');
var html = '<h2><?php print t("Term & Condition"); ?></h2> <br/>' + '<?php echo $body_content; ?>';
print_page.document.open();
print_page.document.write(html);
print_page.print();
print_page.close();
return false;
});
});
发布于 2012-10-17 19:10:05
更改以下内容:
print_page.document.write(html);
print_page.print();
进入:
print_page.document.write(html);
print_page.document.close();
print_page.focus();
print_page.print();
JSFiddle。
发布于 2012-10-17 19:06:06
尝试在head部分添加<meta http-equiv="X-UA-Compatible" content="IE8"/>
,以便页面以IE8模式呈现,并检查它是否有帮助。
https://stackoverflow.com/questions/12932755
复制相似问题