WEB打印設(shè)置處理方案3
發(fā)表時(shí)間:2024-06-09 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]程序代碼:<script Language=VBScript> Function print_onclick //打印函數(shù) Dim label label=document.printinfo.label.value //獲得HTML頁(yè)面的數(shù)據(jù) set objfs...
程序代碼:
<script Language=VBScript>
Function print_onclick //打印函數(shù)
Dim label
label=document.printinfo.label.value //獲得HTML頁(yè)面的數(shù)據(jù)
set objfs=CreateObject("Scripting.FileSystemObject") //創(chuàng)建FileSystem組件對(duì)象的實(shí)例
set objprinter=objfs.CreateTextFile ("LPT1:",true) //建立與打印機(jī)的連接
objprinter.Writeline("__________________________________") //輸出打印的內(nèi)容
objprinter.Writeline(" ")
objprinter.Writeline(" 您打印的數(shù)據(jù)是:"&label& " ”)
objprinter.Writeline(" ")
objprinter.Writeline(" _________________________________ ")
objprinter.close //斷開(kāi)與打印機(jī)的連接
Set objprinter = nothing
Set objfs = nothing // 關(guān)閉FileSystem組件對(duì)象
End Function
</script>
服務(wù)器端腳本:
<%
Set conn=server.CreateObject ("adodb.connection")
conn.Open "DSN=name;UID=XXXX;PWD=XXXX;"
Set Rs = server.CreateObject("adodb.recordset")
Rs.Open("select ……"),conn,1,1
%> //與數(shù)據(jù)庫(kù)進(jìn)行交互
HTML頁(yè)面編碼:
<HTML>
………
<FORM ID=printinfo NAME="printinfo" >
<INPUT type="button" value="打印>>" id=print name=print > //調(diào)用打印函數(shù)
<INPUT type="hidden" id="text1" name="label" value=<%=………%>> //保存服務(wù)器端傳來(lái)的數(shù)據(jù)
………
</HTML>