打印问题,急,帮忙看一下,
<%response.expires=0%>
<html>
<head>
<title>
打印催领通知
</title>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<style type="text/css">
<!--
.bgwhite
tr{ background-color:#cccccc;COLOR: #660000; FONT-SIZE: 12px; FONT-WEIGHT: normal; LINE-HEIGHT: 18px; TEXT-DECORATION: none;
font-size:12px}
.t{COLOR: #660000; FONT-SIZE: 12px; FONT-WEIGHT: normal; LINE-HEIGHT: 18px; TEXT-DECORATION: none;
font-size:12px}
}
-->
</style>
</head>
<!--#include file="adovbs.inc"-->
<!--#include file="zf_include.asp"-->
<%set objCnn=Server.CreateObject("ADODB.connection")
objCnn.open conn '打开送检仪器数据库
set objRS1=server.CreateObject("adodb.recordset")
objRS1.CursorType=adOpenStatic
objRS1.ActiveConnection=objCnn
'打印状态为检测完成的,尚未打印的仪器
objRs1.source="select user_factory_id from device where state_id=3 and printdate=0 group by user_factory_id"
objrs1.open
if objRs1.eof then
response.write("<body bgcolor=#99cc66>没有帐单需要打印</body>")
response.end
end if
do until objRs1.eof
user_factory_id=objRs1("user_factory_id")
set objRS2=server.CreateObject("adodb.recordset")
objRS2.CursorType=adOpenStatic
objRS2.ActiveConnection=objCnn
objRs2.source="select * from user_factory where id='"&user_factory_id&"'"
objRs2.open
FactoryName=objRs2("names")
zip=objRs2("zip")
objRs2.close
%>
<body bgcolor=#99cc66>
<p align="center"><font face="Geneva, Arial, Helvetica, san-serif" size="+2">催领通知 </font></p>
<table CELLPADDING=0 CELLSPACING=0 border=0 width=100% align=center bgcolor=blue>
<tr>
<td>
<table CELLPADDING=0 CELLSPACING=1 border=0 width=100% align=center class="bgwhite">
<tr>
<td>id
</td>
</tr>
<%Dim objCnn,objRS
set objCnn=Server.CreateObject("ADODB.connection")
objCnn.open conn
set objRS=server.CreateObject("adodb.recordset")
objRS.CursorType=adOpenStatic
objRS.ActiveConnection=objCnn
objRS.Source="select * from device order by weiyi Asc"
objRS.open
count=0
'此处对检完仪器的字段名,输出对应记录的记录值%>
<%do until objRS.eof
……
<%objRS.movenext
objRs2.source="update device set printdate=1 where weiyi='"&weiyi&"'"
objRs2.open
loop
%>
</table>
</td>
</tr>
</table>
<%
objRS.close
objRs1.movenext
exit do
loop
%>
<p>
<table width=100%>
<tr>
<td width=90%><a class=t onclick="javascript:window.print();window.close();" target="_self">打印</a>
</td>
<td><font class=t>日期:<%=date()%></font>
</td>
</tr>
</table>
<% set objRs=nothing
objCnn.close
set objCnn=nothing
%>
</body>
<%response.write("<script language=""javascript"">")%>
<!--
window.print();
//window.close()
-->
<%response.write("</script>")%>
</html>
当我在最后使用window.print()想让它自动打印的时候它却打印出来了,没有帐单需要打印,如果我点击打印按钮,则它会打印出正确需要的页面来,奇怪!这是怎么回事?