Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Printing Opera window.close不会在window.print之后启动/执行;“打印”;在打印机选择对话框中单击_Printing_Window_Opera - Fatal编程技术网

Printing Opera window.close不会在window.print之后启动/执行;“打印”;在打印机选择对话框中单击

Printing Opera window.close不会在window.print之后启动/执行;“打印”;在打印机选择对话框中单击,printing,window,opera,Printing,Window,Opera,这个问题只与歌剧有关。其他浏览器也可以:- 使用JavaScript,我创建了一个新窗口,写入文档,然后在窗口对象上调用print和close。 执行打印功能并弹出打印机选择对话框后,如果用户单击“取消”,则执行关闭功能并关闭窗口。但是,如果用户单击“打印”,文档将打印,但窗口不会关闭 这是JS小提琴 http://jsfiddle.net/HEaFP/ 这是我正在使用的代码 var ic_hic_demo_window = window.open("", "", "toolbar=no, s

这个问题只与歌剧有关。其他浏览器也可以:-

使用JavaScript,我创建了一个新窗口,写入文档,然后在窗口对象上调用print和close。 执行打印功能并弹出打印机选择对话框后,如果用户单击“取消”,则执行关闭功能并关闭窗口。但是,如果用户单击“打印”,文档将打印,但窗口不会关闭

这是JS小提琴

http://jsfiddle.net/HEaFP/
这是我正在使用的代码

var ic_hic_demo_window = window.open("", "", "toolbar=no, status=no, directories=no, menubar=no, titlebar=no, location=no, scrollbars=no, resizable=no, height=500, width=500, left=10, top=10");
ic_hic_demo_window.document.open();
ic_hic_demo_window.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><title></title>');
ic_hic_demo_window.document.write('</head><body style="font-family: tahoma, arial, verdana; font-size: 11px" onload="print();close();">'); 
ic_hic_demo_window.document.write("Some sample text");
ic_hic_demo_window.document.write("</body></html>");
ic_hic_demo_window.document.close();
var ic_hic_demo_window=window.open(“,”,“toolbar=no,status=no,directories=no,menubar=no,titlebar=no,location=no,scrollbars=no,resizeable=no,height=500,width=500,left=10,top=10”);
ic_hic_demo_window.document.open();
ic_hic_demo_window.document.write(“”);
ic_hic_demo_window.document.write(“”);
ic_hic_demo_window.document.write(“一些示例文本”);
ic\u hic\u demo\u window.document.write(“”);
ic_hic_demo_window.document.close();

非常感谢您的帮助……

好吧。。如果正在从窗口打印,我想忽略关闭窗口的命令是有意义的,不是吗?你试过做类似的事情吗

onload="print();setInterval(function(){close();}, 500)"
  • 这个想法是,脚本每半秒都会尝试关闭一次窗口,直到它工作为止

是的,这是一个解决办法。但我一直在试图弄清楚为什么print()方法在其他浏览器中是同步的,而不是在opera中。我正在研究更多的同步解决方案,而不是轮询。可能是因为从未在任何地方指定print(),而我们(Opera)也从未意识到其他浏览器已经以这种方式实现了它。。