[英]How to Close Window at onload event of body at IE 8 and IE 7?
I use this code window.onload=function Print(){window.open(); window.close()}
我使用此代码
window.onload=function Print(){window.open(); window.close()}
window.onload=function Print(){window.open(); window.close()}
at YouPrint.aspx. window.onload=function Print(){window.open(); window.close()}
在 YouPrint.aspx。 It working fine at IE 9 but it does not work in IE 8 and IE 7. It shows a JavaScript error like this "Stack Flow error".它在 IE 9 中运行良好,但在 IE 8 和 IE 7 中不起作用。它显示 JavaScript 错误,如“堆栈流错误”。 Why?
为什么? If you have solution, please show me the way to solve this problem.
如果您有解决方案,请告诉我解决此问题的方法。 Please Help me.
请帮我。
Works ok for me in IE7 / IE8 using the following test file:使用以下测试文件在 IE7 / IE8 中对我来说工作正常:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<body onload="window.print(); window.close();">
<span>Test</span>
</body>
</html>
What doc type are you using?您使用的是什么文档类型? I've tested it with strict and that works too.
我已经严格测试过它,它也有效。 More info please...
更多信息请...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.