js调用ocx控件(读写IC卡)

1、注册OCX

开始--->cmd--->regsvr32 *.ocx

2、jsp调用ocx

<OBJECT ID="mscs_ocx" height=0 width=0  
CLASSID="CLSID:64605B9A-BF10-4F16-9303-5A512469E4DF"  
CODEBASE="dcic32.cab#version=1,0,0,1">//如果没有发现该控件,会去当前目录dcic32.cab解压安装该控件   
</OBJECT>  

3、js 里调用
document.getElementById('mscs_ocx');  

4、读写IC卡演示代码
<script language=javascript>   
var a,b,c,d,snr,data,datastr;   
a = Test.InitDev();   
c = Test.GetFunMessage();   
if(a == 0)   
{      
    b = 0;   
    d = 1;   
    while(d){   
    switch(b){   
        case 0:   
            a = Test.ResetCard();   
            c = "ResetCard";   
            if(a == 0){   
                alert(c+"操作成功,");   
                b = 1;   
            }else{   
                b = 200;   
            }   
        break;   
        case 1:   
            a = Test.SetCompanyID("PF","LS","12345678","1234567890123456","流通","123456","071120");   
            c = "SetCompanyID";   
            if(a == 0){   
                alert(c+" 操作成功");   
                b = 2;   
            }else{   
                b = 200;   
            }   
        break;   
        case 2:   
            data = Test.GetCompanyID();   
            a = Test.GetFunRet();   
            c = "GetCompanyID";   
            if(a == 0){   
                alert(c+" 操作成功,数据为:"+data);   
                b = 3;   
            }else{   
                b = 200;   
            }   
        break;   
      case 3:   
            a = Test.WriteBill("123456789012","1234","071120");   
            c = "WriteBill";   
            if(a == 0){   
             alert(c+" 操作成功");   
                b = 4;   
            }else{   
                b = 200;   
            }   
        break;   
        case 4:   
         datastr = Test.ReadBill("01");   
            a = Test.GetFunRet();   
            c = "ReadBill";   
            if(a == 0){   
                alert(c+"操作成功,数据为:"+datastr);   
                b = 5;   
            }else{   
                b = 200;   
            }   
        break;   
        case 5:   
            a = Test.Beep(10);   
            c = "Beep";   
            if(a == 0){   
                alert(c+"操作成功,鸣叫100毫秒");   
                b = 6;   
            }else{   
                b = 200;   
            }   
        break;   
        case 6:   
            alert("演示流程结束");   
            a = Test.ExitDev();   
            d = 0;   
        break;   
        default:   
           alert(c+"操作失败!!");   
            a = Test.ExitDev();   
            d = 0;   
        break;   
    }   
    }   
}   
else  
{   
    alert(c+"请将读写器连接到U口!!");   
}   
</script>  

你可能感兴趣的:(C++,c,linux,jsp,C#)