第二代居民身份证网页ActiveX控件 基准测试网页
2016-08-09 16:37:21
wenxing
2027
运行此页面需要配合L3-U智能卡读写器实现网页读取二代身份证信息的工具,请使用兼容IE或IE内核浏览器。
测试页面http://www.lotuscard.cc/sfz.html 注意:浏览器安全设置里面需要打开“允许运行active X插件”允许安装未取得授信的CAB证书。
nHandle = LotusCardDriver.OpenDevice("",0,0,0); if(nHandle <=0 ) { alert("打开设备失败!"); return; } bResult = LotusCardDriver.Beep(nHandle,10); if(bResult!=1) { alert("蜂鸣失败!"); LotusCardDriver.CloseDevice(nHandle); return; } bResult = LotusCardDriver.SetCardType(nHandle, 'B'); if(bResult!=1) { alert("设置卡类型失败!"); LotusCardDriver.CloseDevice(nHandle); return; } bResult = LotusCardDriver.GetTwoIdInfoByServer(nHandle, '120.24.253.33'); //bResult = LotusCardDriver.GetTwoIdInfoByServer(nHandle, '192.168.1.102'); if(bResult!=1) { nErrorCode = LotusCardDriver.GetTwoIdErrorCode(nHandle); alert("读取二代证信息失败!"+nErrorCode +LotusCardDriver.GetTwoIdErrorInfo(nHandle, nErrorCode)); LotusCardDriver.CloseDevice(nHandle); return; } LotusCardDriver.CloseDevice(nHandle); fillForm();/* var ret = CVR_IDCard.ReadCard(); if (ret == "0"){ fillForm(); return; } alert("读卡错误,错误原因:" + ret);*/}function fillForm() { var pName=LotusCardDriver.TwoId_Name; var pSex=LotusCardDriver.TwoId_Sex; var pNation=LotusCardDriver.TwoId_Nation; var pBorn=LotusCardDriver.TwoId_Birthday; var pAddress=LotusCardDriver.TwoId_Address; var pCardNo=LotusCardDriver.TwoId_No; var pPolice=LotusCardDriver.TwoId_SignedDepartment; var pActivityLFrom=LotusCardDriver.TwoId_ValidityPeriodBegin; var pActivityLTo=LotusCardDriver.TwoId_ValidityPeriodEnd; var pDeviceNo=0;//LotusCardDriver.CardReaderId; var pPhotoBuffer=LotusCardDriver.TwoId_PhotoB64; document.all['Name'].value = pName; document.all['Sex'].value = pSex; document.all['Nation'].value = pNation; document.all['Born'].value = pBorn; document.all['Address'].value = pAddress; document.all['CardNo'].value = pCardNo; document.all['Police'].value = pPolice; document.all['ActivityLFrom'].value = pActivityLFrom; document.all['DeviceNo'].value = pDeviceNo; document.all['ActivityLTo'].value = pActivityLTo; document.all['PhotoBuffer'].value = pPhotoBuffer; document.all['PhotoDisplay'].src = 'data:image/jpg;base64,' + pPhotoBuffer; }function clearForm() { document.all['Name'].value = '' document.all['Sex'].value = '' document.all['Nation'].value = '' document.all['Born'].value = '' document.all['Address'].value = '' document.all['CardNo'].value = '' document.all['Police'].value = '' document.all['ActivityLFrom'].value = '' document.all['ActivityLTo'].value = '' document.all['PhotoBuffer'].value = '' document.all['PhotoDisplay'].src = '' document.all['DeviceNo'].value = '' }
此处列出部分范例代码,仅供参考!