VML+JS的小应用,另有个小问题期望回答 楼主的代码写的很pl,不错,值得赞扬 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 谢谢楼上的赞扬。感觉v:line不好解决,还要考虑没线得中心线坐标,即使是点(1,1)--点(1,9) 宽度1,其区域也是[(0.5,1),(1.5,9)],出现半个px就麻烦了用没有边框的v:rect好像可以起到替代作用,暂时觉得还行,连放大图片缩小显示都作用不大了.自己修改后的方法,供参考://创建条码信息VmlCard.prototype.createBarcode = function(bL,bT,str,bartype,h,n,b,o){ //默认值设置 bL,bT为条码区域在卡片中的坐标(竖向条码时坐标为中心位置?) 必需 if(o==undefined) o=0; //方向 0-正常 1-∠90 2-∠180 3-∠270 if(b==undefined) b=2; //宽线条宽度 px if(n==undefined) n=1; //窄线条宽度 px if(h==undefined) h=20; //条码高度 px if(bartype==undefined) bartype = "CODE39"; //条码类型 现在有 ITF25 和 CODE39 两种 eval("var prn = "+bartype+"(str.toUpperCase());"); var shape_h = h; var shape_w = 10; //留一点点空隙,不让最后条码意外超出范围 好像理想状态不需要 for(var i=0;i<prn.length;i++){ shape_w += ((prn.charAt(i)=="0")?n:b); } var shapObj = document.createElement("<v:group style=\"position:absolute;top:"+bT+";left:"+bL+";width:"+shape_w+"px;height:"+shape_h+"px;\" coordsize=\""+shape_w+","+shape_h+"\" />"); var rect_rl = new Point(0.0,0.0); for(var i=0;i<prn.length;i++){ var wt = ((prn.charAt(i)=="0")?n:b); if(i%2==0){ shapObj.insertBefore(document.createElement("<v:Rect fillcolor=black stroked='f' style=\"position:absolute;top:"+rect_rl.y+";left:"+rect_rl.x+";width:"+wt+";height:"+h+"\"/>")); } rect_rl.moveX(wt); } this.group.insertBefore(shapObj); shapObj.Rotation = 90*o;} JS 怎么在DIV中加入另一个DIV 谁有EXT框架的帮助文档? JAVASCRIPT问题求助,在线等! 网页如何播放声音 关于js取标签内的内容错误 JS去掉空格问题 帮我看看这段js代码,实现ajax drag and drop的 武汉有JSP的开发高手吗? //-----------关于日期时间验证的问题------------- 疑难问题,不知道问题出在哪儿?? img中的alt 文字如果变大??????? 创建activex控件失败
即使是点(1,1)--点(1,9) 宽度1,其区域也是[(0.5,1),(1.5,9)],出现半个px就麻烦了用没有边框的v:rect好像可以起到替代作用,暂时觉得还行,连放大图片缩小显示都作用不大了.自己修改后的方法,供参考://创建条码信息
VmlCard.prototype.createBarcode = function(bL,bT,str,bartype,h,n,b,o){
//默认值设置 bL,bT为条码区域在卡片中的坐标(竖向条码时坐标为中心位置?) 必需
if(o==undefined) o=0; //方向 0-正常 1-∠90 2-∠180 3-∠270
if(b==undefined) b=2; //宽线条宽度 px
if(n==undefined) n=1; //窄线条宽度 px
if(h==undefined) h=20; //条码高度 px
if(bartype==undefined) bartype = "CODE39"; //条码类型 现在有 ITF25 和 CODE39 两种
eval("var prn = "+bartype+"(str.toUpperCase());"); var shape_h = h;
var shape_w = 10; //留一点点空隙,不让最后条码意外超出范围 好像理想状态不需要
for(var i=0;i<prn.length;i++){
shape_w += ((prn.charAt(i)=="0")?n:b);
}
var shapObj = document.createElement("<v:group style=\"position:absolute;top:"+bT+";left:"+bL+";width:"+shape_w+"px;height:"+shape_h+"px;\" coordsize=\""+shape_w+","+shape_h+"\" />"); var rect_rl = new Point(0.0,0.0);
for(var i=0;i<prn.length;i++){
var wt = ((prn.charAt(i)=="0")?n:b);
if(i%2==0){
shapObj.insertBefore(document.createElement("<v:Rect fillcolor=black stroked='f' style=\"position:absolute;top:"+rect_rl.y+";left:"+rect_rl.x+";width:"+wt+";height:"+h+"\"/>"));
}
rect_rl.moveX(wt);
} this.group.insertBefore(shapObj);
shapObj.Rotation = 90*o;
}