关于ASP打印的问题。

来源:百度知道 编辑:UC知道 时间:2024/06/05 20:02:31
想实现直接把从数据库里读出来的信息打印到快递单上,
哪个有现成的例子,或请高手们指教一二。
再说清楚点,现在遇到的难点是:
1。咋打印我指定的部分,没有指定的部分不打印。
2.根据快递单排版定位后,在实际应用中咋调整。

<html>
<head>
<title>打印</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=javascript>
function preview() {
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
window.document.body.innerHTML=bdhtml;
}
</script>
</head>

<body>

<table width="98%" border="0" cellpadding="0" cellspacing="2" align="center">
<tr>
<td height="21" align="center"><input type="button" onClick="preview();window.close()"