打印print

<script type="text/javascript">
function printpreview() {
try {
var HKEY_Root, HKEY_Path, HKEY_Key;
HKEY_Root = "HKEY_CURRENT_USER";
HKEY_Path = "\Software\Microsoft\Internet Explorer\PageSetup\";
var Wsh = new ActiveXObject("WScript.Shell");
HKEY_Key = "header";
Wsh.RegWrite(HKEY_Root + HKEY_Path + HKEY_Key, "");
HKEY_Key = "footer";
Wsh.RegWrite(HKEY_Root + HKEY_Path + HKEY_Key, "");
}
catch (e) {
}
}
function printerDiv(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;
printpreview();
return;
}
</script>
<div class="main_content">
<div class="bread_crumbs">
<a href="#"><span class="home_icon"></span>首页</a>&nbsp; > &nbsp;<label>订单管理</label></div>
<div style="margin-top: 20px; margin-left: 20px; font-size: 20px; color: Black; font-weight: bold;">
<a onclick="printerDiv('content')" style="cursor: hand; cursor: pointer;">打 印 </a>
</div>

原文地址:https://www.cnblogs.com/zwei1121/p/3919137.html