How to print all frames on the page in one file

混江龙づ霸主 提交于 2019-12-25 05:35:32

问题


I am using frameset tag and i want to print all frames inside the frame set

<html>
     <frameset rows="10%,*">
       <frame name="top_frame" src="top-frame.htm" frameborder="1" noresize="0" scrolling="no">
       <frameset cols="20%,*">
          <frame name="left_frame" src="left-frame.htm" frameborder="0" noresize="0" scrolling="no">
          <frame name="right_frame" src="right-frame.htm" frameborder="0" noresize="0" scrolling="auto">
       </frameset>
    </frameset>
</html>

I used parent.window.focus();parent.print(); it works in Chrome, but in IE11 it prints each frame in one file.

any suggestion?

I also used parent.window.focus();window.print(); but it doesn't work in both.


回答1:


This should work:

try{
    document.execCommand('print', false, null);
}
catch(e){
    window.print();
}

Source link



来源:https://stackoverflow.com/questions/31154947/how-to-print-all-frames-on-the-page-in-one-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!