Setting OnLoad event for newly opened window in IE6

前端 未结 6 458
天涯浪人
天涯浪人 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条回答
  •  -上瘾入骨i
    2021-01-21 07:07

    This is not possible unless both pages are on the same domain. Your code does not work in FF, but rather prints the current page. If the pages are on the same domain, then you would write:

    printwindow=window.open('/mypage.html');
    printwindow.onload = function() {
      printwindow.focus();
      printwindow.print();
    }
    

提交回复
热议问题