jquery.PrintArea.js

zhaojm0405 2016-07-25 01:16:17
为什么我用这个jquery插件,不能实现局部打印呢?
%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewPregnantReport.aspx.cs" Inherits="HNTS.ClinicAssessment.ViewPregnantReport" MasterPageFile="~/MasterPages/WindowPage.master" %>
<%@ Import Namespace="Wincome.Components.Utility" %>
<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="server">
<script src="../JQuery/jquery.PrintArea.js" type="text/javascript"></script>
<script type="text/javascript" src="../js/admin.js"></script>
<script type="text/javascript" src="../js/XY.js"></script>
<script type="text/javascript" language="javascript">
var bmi = <%= bmi %>; //bmi
var wt = <%= wt %>; //体重
var pk = <%= pk %>; //孕周数


$(document).ready(function () {
ClientPregnantChangeBackImage(bmi);
//window.print();
});

var hkey_root, hkey_path, hkey_key;
hkey_root = "HKEY_CURRENT_USER";
hkey_path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";


function PrintReport() {
pagesetup_null();
$("#divPrint").hide();
$("#printContent").printArea();
pagesetup_default();
$("#divPrint").show();
}

function pagesetup_null() {
try {
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key = "header";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
hkey_key = "footer";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "&d &T&b<%=Wincome.Components.Config.AppSetting.DefaultHospName %>&b页码/页数:&p/&P");
hkey_key = "margin_bottom";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.1800000");
hkey_key = "margin_left";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.200000");
hkey_key = "margin_right";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.200000");
hkey_key = "margin_top";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.200000");
} catch (e) {
}
}

// 恢复默认的页宽、页头、页脚
function pagesetup_default() {
try {
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key = "header";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "w&b页码,&p/&P(&W)");
hkey_key = "footer";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "&u&b&d");
hkey_key = "margin_bottom";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.750000");
hkey_key = "margin_left";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.750000");
hkey_key = "margin_right";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.750000");
hkey_key = "margin_top";
RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "0.750000");
} catch (e) { }
}

</script>
<div id="divPrint">
<input type="button" id="btnSave" value="打印" onclick="PrintReport();"/>
</div>
<div id="printContent">
<div style="height: 30px; line-height: 30px; width: 835px; margin: 0 auto; font-weight: bold;float:left;">
<asp:Label ID="lblMsg" runat="server"></asp:Label>
</div>
<div style="width: 835px; height: 480px; margin: 0 auto;float:left;">
<div id="dian" style="width: 9px; height: 9px; position: absolute; top:<%=top %>; left:<%=left %>; background-color: #F95C93;">
<img style="width: 10px; height: 10px; " src="../images/dian.jpg"/>
</div>
<div>
<img id="resultDiv" style=" width: 835px;height: 510px;" src="../skins/azury/pregnant_img/<%=imgname %>" />
</div>
</div>
</div>
</asp:Content>


...全文
185 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhaojm0405 2016-07-25
  • 打赏
  • 举报
回复
打印了整个页面,就是把打印按钮也打印出来了,请问有人遇到这种情况吗?

87,902

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧