<script language=javascript>
    var printIt = function() {
        if (confirm('确定打印吗?')) {
            bindData();
            var mWindow = window;
            window.document.body.innerHTML = document.getElementById("form").innerHTML;
//字体调整 $(
"input,label,select,textarea,radio-inline").css("font-size", "8px"); $("label").css("font-weight","lighter"); mWindow.print(); } } var windowClose = function() { window.opener = null; window.open('', '_self'); window.close(); }; //将表单中的数据进行绑定,便于html()的时候获取到 function bindData(){ $("input").each(function(){ $(this).attr('value',$(this).val()); }); $("input[type='radio']:checked").each(function(){ $(this).attr('checked', true); }); $("select option:selected").each(function() { $(this).attr('selected', true); }); //搞定 textarea $("textarea").each(function() { $(this).html($(this).val()); }); } </script> <style type="text/css" media=print> .Noprint{display : none } </style> <center class="Noprint"> <p class="Noprint"> <OBJECT ></OBJECT> <input type=button value="打印" onclick="printIt()">&nbsp;&nbsp; <input type=button value="关闭" onClick="windowClose()">&nbsp;&nbsp;<br/> </p> </center>

然后在主页面引入即可

<title>打印</title>
<%@include file="/avicit/ims/hr/common/print/print.jsp"%>

 

相关文章:

  • 2021-10-19
  • 2021-07-30
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
猜你喜欢
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
相关资源
相似解决方案