梦幻之旅

DEBUG - 天道酬勤

   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  671 随笔 :: 6 文章 :: 256 评论 :: 0 Trackbacks
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
    
<HEAD>
    
</HEAD>
    
<BODY>
        
<script type='text/javascript' language='javascript'>
                    
function testLabPrint()
                    
{
                          
var personA = new Person(null,null,null,null,null);
                          
var personB = new Person(null,null,null,null,null);
                          labPrint(personA, personB, 
false);
            }


                    
function Person(postCode,addr,compayName,userName,attach)
                    
{
                        
this.postCode="200000";
                        
this.addr="中国上海市嘉定区封浜镇曹安公路15号桥南200米";
                        
this.compayName="封浜印刷厂";
                        
this.userName="惠万鹏";
                        
this.attach="Mobil:13816360376  QQ:182429125";
                        
this.isAlive=false;
                        
                        
//数据的有效性的验证
                        if(postCode==null || postCode.length==0//验证邮编
                           return;
                        
if(addr==null || addr.length==0//验证地址
                           return;
                        
if(userName==null || userName.length==0//验证地址
                           return;

                        
this.postCode=postCode;
                        
this.addr=addr;
                        
this.compayName=compayName;
                        
this.userName=userName;
                        
this.attach=attach; 
                        
this.isAlive=true;
                    }

                     
            
function labPrint(perA, perB, isSkip)
                    
{
                
var TSCObj = null;
                TSCObj 
= new ActiveXObject("TSCActiveX.TSCLIB");
                TSCObj.ActiveXopenport (
"TSC TTP-243E Plus");
                TSCObj.ActiveXsetup (
"100","120","4","10","0","2","0");
                TSCObj.ActiveXsendcommand (
"SET TEAR ON");
                TSCObj.ActiveXclearbuffer();
            
            
                    
//ActiveXprinterfont ("开始像素X","开始像素Y","字体高度","旋转角度","字体风格","下划线","字体名", "ActiveXdll Test!!");
                    var heightOffset = 405;
            
if(!isSkip)
                    
{
                TSCObj.ActiveXwindowsfont (
330 + heightOffset, 403627000"arial", perB.postCode);
                        TSCObj.ActiveXwindowsfont (
285 + heightOffset, 403627000"arial", perB.addr);
                        TSCObj.ActiveXwindowsfont (
230 + heightOffset, 403627000"arial", perB.compayName);
                        TSCObj.ActiveXwindowsfont (
150 + heightOffset, 3203627000"arial",perB.userName);
                        TSCObj.ActiveXwindowsfont (
80 + heightOffset, 4003627000"arial", perB.attach);
                    }

                    TSCObj.ActiveXwindowsfont (
330403627000"arial", perA.postCode);
                    TSCObj.ActiveXwindowsfont (
285403627000"arial", perA.addr);
                    TSCObj.ActiveXwindowsfont (
230403627000"arial", perA.compayName);
                    TSCObj.ActiveXwindowsfont (
1503203627000"arial", perA.userName);
                    TSCObj.ActiveXwindowsfont (
804003627000"arial", perA.attach);

            TSCObj.ActiveXprintlabel (
"1","1");
            TSCObj.ActiveXcloseport();
                    }

                    
            testLabPrint();
            
</script>
    
</BODY>
</HTML>
posted on 2010-06-03 14:31 HUIKK 阅读(661) 评论(0)  编辑  收藏 所属分类: JavaScript

只有注册用户登录后才能发表评论。


网站导航: