问题
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