在好例子网,分享、交流、成长!
您当前所在位置:首页ASP 开发实例ASP网页编程 → asp 条形码生成器 实例源码下载

asp 条形码生成器 实例源码下载

ASP网页编程

下载此实例
  • 开发语言:ASP
  • 实例大小:4.92KB
  • 下载次数:31
  • 浏览次数:333
  • 发布时间:2014-08-28
  • 实例类别:ASP网页编程
  • 发 布 人:liuzhiheng
  • 文件格式:.rar
  • 所需积分:2
 相关标签: 条形码

实例介绍

【实例简介】
【实例截图】

【核心代码】

<title>条形码生成</title>
<%
Rem =================================================================
Rem = 函数:ean13
Rem = 说明:生成EAN13标准的条形码,有实例(ASP代码)
Rem = 版本:1.0.0
Rem = 作者:第七种直角(7th/semico)
Rem = Date:2005-08-08 11:57:06
Rem = QQ:11110785
Rem = QQ群:3773360
Rem = 适用:按照需要生成EAN13标准的条形码
Rem =================================================================

Function ean13(code,w,h)
	Dim Guide,Dict,Lencode,Rencode,cStart,cMid,cEnd,Barcode,Lmethod
	Guide = array("AAAAAA","AABABB","AABBAB","ABAABB","ABBAAB","ABBBAA","ABABAB","ABABBA","ABBABA")

	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
	cWidth=w	'条码单元宽度
	cHeight=h	'条码高度

	'检验条码是否符合标准
	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 "<div style='position:absolute;width:"&cWidth*95 60&"px; height:"&cHeight 30&"px; background:"&bg&";'>"
	'绘制条码
	for x=1 to len(barcode)
		if x<5 or x>92 or (x>46 and x<51)then
			sh=10
		else
			sh=0
		end if

		if mid(barcode,x,1)="1" then
			bColor=fg
		else
			bColor=bg
		end if

		response.write "<div style='position:absolute;left:"&(x-1)*cWidth 30&"px;top:5px;width:"&cWidth&"px;height:"&cHeight 5 sh&"px;background:"&bColor&";'></div>"
	next
	'加入可读数字标签
	response.write "<div style='position:absolute;left:16px;top:"&cHeight 10&"px;background:"&bg&";color:"&fg&";font:12px Verdana;'>"&left(code,1)&"</div>"
	for x=1 to 6
		response.write "<div style='position:absolute;left:"&(x*7 2)*cWidth 22&"px;top:"&cHeight 10&"px;background:"&bg&";color:"&fg&";font:12px Verdana;'>"&mid(code,x 1,1)&"</div>"
		response.write "<div style='position:absolute;left:"&(x*7 47)*cWidth 24&"px;top:"&cHeight 10&"px;background:"&bg&";color:"&fg&";font:12px Verdana;'>"&mid(code,x 7,1)&"</div>"
	next
	response.write "<div style='position:absolute; left:30px;top:"&cHeight 25&"px;width:"&cWidth*95&"px;height:10px;text-align:center;background:#ffffff;border:solid 1px #e5e5e5;font:9px verdana;'>&copy; 2007 by elbo </div>"
	response.write "</div>"
End Function

%>  
<p style="font:12px Verdana">
<a href="http://www.alimama.com/membersvc/rd.do?w=p_10061133&p=&f=http://www.alimama.com/membersvc/promotion/tjyj.htm">
<span style="text-decoration: none">
<font color="#000000">函数:ean13</font></span></a><br />
<a href="http://www.alimama.com/membersvc/rd.do?w=p_10061133&p=&f=http://www.alimama.com/membersvc/promotion/tjyj.htm">
<span style="text-decoration: none">
<font color="#000000">适用:按照需要生成EAN13标准的条形码</font></span></a><br /><a href='http://www.alimama.com/membersvc/rd.do?w=p_10061133&p=&f=http://www.alimama.com/membersvc/promotion/tjyj.htm'  target='_blank'><img border="0" src="http://img.alimama.cn/images/adzone/banner_tjyj_468x60.gif" /></a><br />
可以试验以下条码:<br />
9787900420206<br />
9787894954947
</p>
<br />
<form method="post" action="../../../../../../txm/index.asp">
	<label>
		<input type="" name="bcode" />
	</label>
	<input type="submit" value="生成条码"/>
</form>
<p align="center"></p>

<p align="center">

<%
if request("bcode")<>"" then
	call ean13(request("bcode"),2,100)
else
	call ean13("1234567890128",2,100)
end if

%>
</br></a>版权所有 Elbo.cn<script src='http://s33.cnzz.com/stat.php?id=621881&web_id=621881' language='JavaScript' charset='gb2312'></script></p>

标签: 条形码

实例下载地址

asp 条形码生成器 实例源码下载

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

第 1 楼 Breatdream 发表于: 2022-05-23 09:49 42
完全无用

支持(0) 盖楼(回复)

发表评论

(您的评论需要经过审核才能显示)

查看所有1条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警