1、首先在自己电脑上装好使用打印机的驱动;
2、HTML页面弄这个打印即可
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="printarea/jquery-1.10.2.js" type="text/JavaScript" language="javascript"></script>
<script src="printarea/jquery-ui-1.10.4.custom.js"></script>
<script src="printarea/jquery.PrintArea.js" type="text/JavaScript" language="javascript"></script>
<script language="javascript">
function printdiv(printpage){
var headstr="<html><head><title></title></head><body>";
var footstr="</body>";
var newstr=document.all.item(printpage).innerHTML;
var oldstr=document.body.innerHTML;
document.body.innerHTML=headstr+newstr+footstr;
window.print(); //调用浏览器打印控件
document.body.innerHTML=oldstr;
return false;
}
</script>
<title>div print</title>
</head>
<body>
<input type="button" onClick="printdiv('div_print');" value=" 打印 ">
<div id="div_print">
<h1 style="Color:Red">被打印区域:www.phpernote.com</h1>
</div>
这块区域是打印不到的!
</body>
</html>
printarea云盘已保存