问候!
我是一个正在努力学习 html 和 javascript 的菜鸟 - 慢慢地。我正在尝试打印 SimpleModal 提供的 DIV。页面位于:
www.planetsarsfield.com
这个“打印”功能位于底部的配方框中。在 FF 中一切都很好,但在 IE8 中根本不起作用。我肯定做错了什么,但我无法发现它。
有什么想法吗?
干杯, 泰 ++++++++++++++++++++++++++++++++++++++++++++++++++++
<script type="text/javascript">
function PrintElem(elem)
{
Popup($(elem).html());
}
function Popup(data)
{
var mywindow = window.open('', 'basic-modal-content', 'height=400,width=600');
mywindow.document.write('<html><head><title>on the grill... latest recipe</title>');
mywindow.document.write('<link href="PATH/print.css" rel="stylesheet" type="text/css" />')
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.print();
return true;
}
</script>
最佳答案
您使用的窗口名称使 IE 感到难过。请尝试“BasicModalContent”。 (“window.open”的第二个参数就是我所说的。)
关于Javascript 打印脚本在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2669530/