本文介绍了打印ModalPanel的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以仅打印>的内容?

Is it possible to print just the contents of <rich:modalPanel>?

推荐答案

将rich:modalpanel的所有内容包装在div中,然后使用以下javascript代码段进行工作,这当然不是标准的.在Richmodal面板上添加一个点击按钮,即可在javascript中调用此功能

Wrap all the content of rich:modalpanel in a div then use following javascript snippet to do your work, of course it is not standard. add a print button in richmodal panel on click call this function of javascript

function PrintContent()
{
var DocumentContainer = document.getElementById('divtoprint');
var WindowObject = window.open("", "PrintWindow",
"width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
setTimeout(function(){
    WindowObject.focus();
    WindowObject.print();
    WindowObject.close();
},6000);
}

来源: http://www.isolutionteam .co.uk/printing-contents-of-a-div-using-javascript/

这篇关于打印ModalPanel的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 21:05