เลือกพิมพ์เนื้อหาในหน้าเนื่องจากความต้องการของโครงการ
รับสิ่งที่คุณต้องการพิมพ์ด้วยชั้น div ตัวอย่างเช่น:
การคัดลอกรหัสมีดังนี้:
<!-ประกาศการถ่ายโอนเรื่องคำร้องเริ่มต้น->
<div id = "itemvrbjform" style = "font-family: 'เพลงเพลง', 'song style';
<div>
<div style = "float: ขวา; margin -top: -40px;"> (หมายเลขข้อมูล: $ {zjxfitemuser.acceptedno}) </div>
<div id = "title" style = "margin-top: 40px;"
$ {zjxfitemuser.username}: (ชื่อของผู้ร้อง) <br/>
<span id = "itemvrbjtime"> </span> เอเจนซี่นี้ (หรือหน่วย) ได้ยอมรับ $ {zjxfitemuser.subject} เรื่องคำร้องที่เสนอโดยคุณ (หรือคุณ) ตามกฎหมาย
เรื่องคำร้องอยู่ในขอบเขตของอำนาจของ XXX . <br/>
แจ้งให้เราทราบที่นี่ <br />
<div style = "margin-top: 50px; margin-right: 20px; float: ขวา;"> (sub-sub-name} ซีลพิเศษหรือซีลอย่างเป็นทางการ) </div>
<div style = "margin-top: 90px; margin-right: -190px; float: ขวา;"> <span id = "itemvrbjendtime"> </span> </div>
</div>
</div>
<!-ประกาศการถ่ายโอนเรื่องคำร้องสิ้นสุดลง->
ไม่จำเป็นต้องพิมพ์ตรงกลางและยังรวมอยู่ในชั้น div ใช้สไตล์ CSS การอ้างอิงคลาส = "noprint" ในเลเยอร์ที่ไม่ต้องการการพิมพ์เสร็จสิ้น
การคัดลอกรหัสมีดังนี้:
<style type = "text/css" media = "print">
.noprint {การมองเห็น: ไม่มี;}
</style>
รหัส JS:
หมายเหตุ: เมื่อเลือกการพิมพ์สไตล์จะหายไป
การคัดลอกรหัสมีดังนี้:
$ (function () {
$ ("#print") คลิก (function () {
var html = window.document.body.innerhtml;
ExportCss ("itemvrbjform", html);
-
// สไตล์นำเข้าเพื่อเลือกการพิมพ์
ฟังก์ชั่น 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;
-
-
สิ่งนี้ช่วยให้การพิมพ์บางส่วนและการพิมพ์ที่ไม่เลือกบางส่วนสามารถทำได้