Javascript 打印脚本在 IE 中不起作用

标签 javascript simplemodal

问候!

我是一个正在努力学习 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/

相关文章:

javascript - react : How could I add a fade out animation on delete on dynamically generated table entries?

javascript - 如何顺时针或逆时针旋转图像,以较短者为准?

jquery - SimpleModal 确认覆盖 : Would like callback to return true or false instead of URL redirect

javascript - 我应该如何在打开 SimpleModal 对话框的 BackBone.js View 中取消绑定(bind)事件?

javascript - 使用 1 个输入字段存储 2 个值

javascript - Kendo 中自定义按钮的鼠标悬停事件的工具提示?

jQuery simplemodal 禁用滚动

iframe - SimpleModal 在 IE 9 中不起作用(在 Iframe 内)

php - XmlHttpRequest 与 cURL

javascript - 模态错误....为正确的模态视图发送 id。如何做?