プロジェクトのニーズにより、ページでコンテンツを印刷することを選択します。
Divレイヤーで印刷したいものをピックアップします。例えば:
コードコピーは次のとおりです。
<! - 請願書の譲渡の通知が始まります - >
<div id = "itemvrbjform" style = "font-family: 'song song'、 'song style'; font-size:18px; margin-top:290px;"
<div>
<div style = "float:right; margin -top:-40px;">(情報番号:$ {zjxfitemuser.acceptedno})</div>
<div id = "title" style = "margin-top:40px;"
$ {zjxfitemuser.username} :(申立人の名前)<br/>
<span id = "itemvrbjtime"> </span>、この代理店(またはユニット)は、法律に従って提案された$ {zjxfitemuser.subject}請願書を受け入れました。
請願書は、「手紙と請願規制」の関連する規定に従って、XXXのXXXX、XXXに連絡してください。 <br/>
ここに私に知らせてください。 <br />
<div style = "margin-top:50px; margin-right:20px; float:right;">(sub-sub-name}スペシャルシールまたは公式シール)</div>
<div style = "マージントップ:90px;マージン右:-190px; float:right;"> <span id = "itemvrbjendtime"> </span> </div>
</div>
</div>
<! - 請願書の譲渡事項の通知終了 - >
中央に印刷する必要はなく、Div層にも含まれています。 CSSスタイルを使用します。参照class = "noprint"印刷を必要としないレイヤーの
コードコピーは次のとおりです。
<style type = "text/css" media = "print">
.noprint {visibility:none;}
</style>
JSコード:
注:印刷を選択すると、印刷する前にプリントを追加する必要があります。
コードコピーは次のとおりです。
$(function(){
$( "#print")。クリック(function(){
var html = window.document.body.innerhtml;
exportcss( "itemvrbjform"、html);
});
//印刷を選択するためにスタイルをインポートします
function exportcss(formname、htmlinfo){
var css = "<link href =/" " + baseurl +"/zjxf/common/css/common.css/"type =/" text/css/"rel =/" styleSheet/"/>" + " +"
"<link href =/" " + baseurl +"/zjxf/common/css/table.css/"type =/" text/css/"rel =/" styleSheet/"/>" +
"<link href =/" " + baseurl +"/zjxf/common/css/form.css/"type =/" text/css/"rel =/" styleSheet/"/>" +
"<link href =/" " + baseurl +"/zjxf/common/css/tab.css/"type =/" text/css/"rel =/" styleSheet/"/>" +
"<link href =/" " + baseurl +"/zjxf/common/css/print.css/"type =/" text/css/"rel =/" styleSheet/"/>";
$(css).appendto( "#" + formname);
window.document.body.innerhtml = $( "#" + formname).html();
window.print();
window.document.body.innerhtml = htmlinfo;
}
});
これにより、部分的な選択印刷と部分的な非選択印刷の両方を達成できます