jsまたはjqueryを実現し、ページの印刷は部分的に印刷できます。
jsまたはjqueryは、ページ印刷(ローカルプリント)1、js実現(ローカルプリントが可能)
<html>
<title>js </title>
<head></head><body>
<input id="btnPrint" type="button" value=" " onclick="javascript:window.print();" />
<input id="btnPrint" type="button" value=" " onclick=preview(1) />
<style type="text/css" media=print>
.noprint{display : none }
</style>
<p class="noprint"> </p>
<script>
function preview(oper)
{
if (oper < 10)
{
bdhtml=window.document.body.innerHTML;// html
sprnstr="<!--startprint"+oper+"-->";//
eprnstr="<!--endprint"+oper+"-->";//
prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); // html
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));// html
window.document.body.innerHTML=prnhtml;
window.print();
window.document.body.innerHTML=bdhtml;
} else {
window.print();
}
}
</script>
<p>XXXXX</p>
<!--startprint1--> <!--endprint1-->
</body>
</html>
2、ウィンドウズの下層印刷を起動し、セキュリティ警告を報告し、
<HTML>
<HEAD>
<TITLE>javascript - - </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312" />
<SCRIPT language=javascript>
function printsetup(){
//
wb.execwb(8,1);
}
function printpreview(){
//
wb.execwb(7,1);
}
function printit()
{
if (confirm(' ?')) {
wb.execwb(6,6);
}
}
</SCRIPT>
</HEAD>
<BODY>
<DIV align=center>
<OBJECT id=wb height=0 width=0
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 name=wb></OBJECT>
<INPUT onclick=javascript:printit() type=button value= name=button_print />
<INPUT onclick=javascript:printsetup(); type=button value= name=button_setup />
<INPUT onclick=javascript:printpreview(); type=button value= name=button_show />
</DIV>
</BODY>
</HTML>
3、jQueryの使用を推奨しない(ローカルプリントに対応)
<html>
<head>
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script>
$(function(){
$("input#biuuu_button").click(function(){
$("div#myPrintArea").printArea();
});
</script>
</head>
<body>
<input id="biuuu_button" type="button" value=" "></input>
<div id="myPrintArea">..... .....</div> <div class="quote_title"> </div><div class="quote_div"></div>
</body>
</html>