证书打印

本文提供了一段JavaScript脚本,用于设置网页打印时的页眉、页脚为空,并调整打印边距,确保网页内容能够完整地打印出来。
<script language="JavaScript">
var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root="HKEY_CURRENT_USER";
HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
//设置网页打印的页眉页脚为空
function Print()
{
try
{
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,"");
window.print();
}
catch(e){}
}
//设置网页打印的页眉页脚为默认值
function PageSetup_Default()
{
try
{
var Wsh=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&w&b页码,&p/&P");
HKEY_Key="footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&u&b&d");
}
catch(e){}
}
</script>


</head>

<Script language="JavaScript">
function Print()
{
if(window.print)
{
factory.printing.header = ""
factory.printing.footer = ""
factory.printing.portrait =false
factory.printing.leftMargin = 0
factory.printing.topMargin = 0
factory.printing.rightMargin = 0
factory.printing.bottomMargin = 0
factory.printing.Print(true);

}

}

含插件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<Script language="JavaScript">
function init()
{
window.print();
}
</Script>
<style type="text/css">
.CertificateCon{ width:887px; height:620px; margin:0 auto; clear:both; background: url(zshu.gif) no-repeat;letter-spacing:-1px;
font-weight:bold; padding-top:250px; font-family:"宋体"}
.CertificateCon p{ margin:15px 0; padding:0;}
.CertificateZihao{ width:650px; margin:0 auto; text-align:right; overflow:hidden; font-size:20px;}
.CertificateTxt{ overflow:hidden;width:650px; margin:0 auto;font-size:24px}
.CertificateFoot{width:650px; margin:0 auto; text-align:right; overflow:hidden; font-size:20px;}
.inputstyle{ border:none; border-left:none;border-right:none; height:18px; font-size:12px; font-weight:normal; visibility:hidden}
</style>
</head>

<Script language="JavaScript">
function Print()
{
if(window.print)
{
factory.printing.header = ""
factory.printing.footer = ""
factory.printing.portrait =false
factory.printing.leftMargin = 0
factory.printing.topMargin = 0
factory.printing.rightMargin = 0
factory.printing.bottomMargin = 0
factory.printing.Print(true);

}

}

</Script>
<body onload="Print();">
<object id=factory viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="smsx.cab#Version=6,1,428,11"></object>
<div class="CertificateCon">
<div class="CertificateZihao">证书登记(<input size="5" class="inputstyle" type="text" />)第<input size="5" class="inputstyle" type="text" />号</div>
<div class="CertificateTxt">
<p>
<input size="25" class="inputstyle" type="text" />
同学系
<input size="56" class="inputstyle" type="text" />
学生</p>
<p></p>
<p>于
<input size="8" class="inputstyle" type="text" />
学年获得杭州市中等职业学校政府奖学金,以资</p>
<p>鼓励</p>
</div>
<div class="CertificateFoot">
<p>杭州市教育局学生资助工作领导小组办公室</p>
<p><input size="60" class="inputstyle" type="text" /></p>
<p><input size="5" class="inputstyle" type="text" />年<input size="5" class="inputstyle" type="text" />月<input size="5" class="inputstyle" type="text" />日 </p>
</div>
<div></div>
</div>

</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值