Setting OnLoad event for newly opened window in IE6

前端 未结 6 523
天涯浪人
天涯浪人 2021-01-21 06:40

I need to set the onload attribute for a newly popped-up window. The following code works for Firefox:



        
6条回答
  •  情书的邮戳
    2021-01-21 07:13

    You are relying on "printwindow.document.body.onload=self.print();" line being executed before the child document finishes loading. I don't think you can be guaranteed that.

    Here's an idea: prepare HTML or a page that has nothing but the page you need in an iframe. This page will have body.onload=self.print().

提交回复
热议问题