我正在尝试使用 javascript 打开一个新窗口,并用当前窗口中的 html 填充它。有点像在新窗口中使用新 css 进行打印预览。
function prnt() {
var pr = window.open("", "", "width=1020,height=750");
pr.document.open();
pr.document.write('<html><head><title>Test</title>');
pr.document.write('<link href=print.css rel=Stylesheet></head><body>');
pr.document.write(document.body.innerHTML);
pr.document.write('</body></html>');
pr.document.close();
pr.focus();}
我从这里调用这个函数:
<a id="print" href="#" runat="server" onclick="javascript:prnt();">PRINT</a>
IE 给我错误远程过程调用失败,它似乎指向这一行:
pr.document.close();
不过在 FF 中一切正常。有任何想法吗?
编辑
我在 Windows Server 2008 R2 Standard 上运行
SP1
编辑2
如果我删除 pr.document.close(); 页面在 IE 中完美运行,并且 完成 显示在状态栏中。
不过,现在FF不能正常工作了。该页面实际上从未停止加载。我猜它正在等待 pr.document.close(); 命令?
最佳答案
关于javascript - "the remote procedure call failed"- 仅限 IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5580561/