Set Dict = CreateObject("Scripting.Dictionary")
Dict.Add "A", "0001101001100100100110111101010001101100010101111011101101101110001011"
Dict.Add "B", "0100111011001100110110100001001110101110010000101001000100010010010111"
Rencode = array("1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100")
cStart="101"
cMid="01010"
cEnd="101"
if w<2 then w=2
if h<20 then h=20
c条码单元宽度
c条码高度
'检验条码是否符合标准
if len(code)<>13 then response.write "必须为13位!":response.end
for i=1 to 12
if IsNumeric(mid(code,i,1)) then
if i mod 2 then
rsum=rsum+int(mid(code,i,1))
else
lsum=lsum+int(mid(code,i,1))
end if
else
response.write "必须为数字码!":response.end
end if
next
if 10-((lsum*3+rsum) mod 10) <> int(right(code,1)) then response.write "此条码错误!":response.end
'转换条码
Barcode=cStart
Lmethod=left(code,1)
'if Lmethod=0 then Lmethod=1
for i=2 to 7
barcode = barcode & mid(Dict(Mid(Guide(Lmethod-1),i-1,1)),(7*mid(code,i,1)+1),7)
next
barcode=barcode & cMid
for i=8 to 13
barcode = barcode & Rencode(mid(code,i,1))
next
barcode=barcode & cEnd
fg="#000000" '条码前景色
bg="#ffffff" '条码背景色
response.write "
if mid(barcode,x,1)="1" then
bColor=fg
else
bColor=bg
end if
response.write "
"%>
适用:按照需要生成EAN13标准的条形码
可以试验以下条码:
9787900420206
9787894954947
<%
if request("bcode")<>"" then
call ean13(request("bcode"),2,100)
else
call ean13("1234567890128",2,100)
end if
%>
版权所有