以腈纶电子的读卡器为例

下载控件IDCardReader.ocx并注册

cd /d "%~dp0"

regsvr32 IDCardReader.ocx

CLS</P>

样例

<body style="text-align: center">

<form id="form1" runat="server">    
    <OBJECT classid="clsid:10946843-7507-44FE-ACE8-2B3483D179B7"
 id="CVR_IDCard" name="CVR_IDCard" width="0" height="0" >
</OBJECT>

<script language="javascript" type ="text/javascript">

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['IssuedAt'].value = ""; 
                       document.all['EffectedDate'].value = ""; 
                       document.all['ExpiredDate'].value = ""; 
                       document.all['SAMID'].value = ""; 
                       document.all['pic'].src = ""; 
                       document.all['Picture'].value = "";  
                       document.all['PictureLen'].value = "";     
                       return true;
}
function Button1_onclick() {
                    var CVR_IDCard = document.getElementById("CVR_IDCard");
var strReadResult = CVR_IDCard.ReadCard();

if(strReadResult == "0")
{
ClearForm();
 document.all['Name'].value = CVR_IDCard.Name;                            document.all['Sex'].value = CVR_IDCard.Sex;    
                          document.all['Nation'].value = CVR_IDCard.Nation; 
                          document.all['Born'].value = CVR_IDCard.Born;     
                          document.all['Address'].value = CVR_IDCard.Address; 
                          document.all['CardNo'].value = CVR_IDCard.CardNo; 
                          document.all['IssuedAt'].value = CVR_IDCard.IssuedAt;  
                          document.all['EffectedDate'].value = CVR_IDCard.EffectedDate;  
                          document.all['ExpiredDate'].value = CVR_IDCard.ExpiredDate;
                          document.all['SAMID'].value = CVR_IDCard.SAMID;
                          document.all['pic'].src = CVR_IDCard.Pic;
                          document.all['Picture'].value = CVR_IDCard.Picture;  
                          document.all['PictureLen'].value = CVR_IDCard.PictureLen  
                      }
                      else
                      {
alert('重试' );

}

}

function Button3_onclick() {

var t1;
  var returns;
    var IdrControl1 = document.getElementById("IdrControl1");
    t1 = IDCardReadJL(IdrControl1); 
if (t1.Name != null)
{
    //returns = t1.Name;
     document.all['Name'].value = t1.Name;            
 document.all['Sex'].value = t1.Sex;    
              document.all['Nation'].value = t1.Nation; 
              document.all['Born'].value = t1.Birth;     
              document.all['Address'].value = t1.Address; 
              document.all['CardNo'].value = t1.CardNo; 
              document.all['IssuedAt'].value = t1.Police;  
              document.all['EffectedDate'].value = t1.ValidDateFrom;  
              document.all['ExpiredDate'].value = t1.ValidDateTo;
              document.all['SAMID'].value = t1.SAMID;
                          document.all['pic'].src = t1.PhotoPath;
                          document.all['Picture'].value = t1.PhotoBase64Info;  
                          document.all['PictureLen'].value = t1.PictureLen  
}
    
    t1=null;

}

function IDCardReadJL(CardReaderID){

var obj = CardReaderID;//document.getElementById(CardReader1);  
//注意:第一个参数为对应的设备端口,USB型为1001,串口型为1至16  
var rst;
var photoPath="c:\\cardPhoto\\"+Math.floor(Math.random()*100000000)+".bmp";
rst = obj.ReadCard("1001",photoPath); 
if (rst==1){
var t = new Object;
//获取各项信息
t.Name  =obj.GetName();
t.Sex    =obj.GetSex();
t.Nation =obj.GetFolk();
t.Address=obj.GetAddress();
t.CardNo=obj.GetCode();
t.Birth   =obj.GetBirthYear()+'-'+obj.GetBirthMonth()+'-'+obj.GetBirthDay();  
t.Police  = obj.GetAgency() ;
var strValidDate = obj.GetValid();  
//t.ValidDate = obj.GetValid();
t.ValidDateFrom=strValidDate.split("-")[0].replace(".","-").replace(".","-");
t.ValidDateTo=strValidDate.split("-")[1].replace(".","-").replace(".","-");
t.PhotoBase64Info=obj.GetPhotobuf(); 
t.PhotoPath = photoPath;
obj = null;
return t;
}
else
{
alert("未能获取读卡器实例,请检查\r\n1.是否已正确安装读卡器\r\n2.是否将身份证放入读卡器"); 
return GetEmpty();

}
//返回空的数据
function GetEmpty()
{
var t = new Object;
 
t.Name  ="";
t.Sex    ="";
t.Nation ="";
t.Address="";
t.CardNo="";
t.Birth   ="";  
t.Police  =""; 
t.ValidDateFrom="";
t.ValidDateTo="";
t.PhotoBase64Info="";
t.PhotoPath = "";
return t;
}
 
function ReadCardInfo()
{

var t1;
  var returns;
 
 
var IdrControl1 = document.getElementById("IdrControl1");
    t1 = IDCardReadJL(IdrControl1); 
    returns = t1.Name;
    alert(returns);
    
    t1=null;
    /*
其中:IDCardReadJL 精伦读卡器调用方法名,IdrControl1为控件名称
返回值:
t1.Name 姓名
t1.CardNo 身份证号码
t1.Sex 性别(格式:男)
t1.Nation 民族(格式:汉)
t1.Birth 出生日志(格式:1900-01-01)
t1.Address 地址
t1.Police 发证机关
t1.ValidDateFrom 身份证有效开始时间
t1.ValidDateTo 身份证有效结束时间
t1.PhotoPath 本地生产的图片路径
t1.PhotoBase64Info 图片的base64编码
*/

}
</script>

</script>
   <table style="width: 638px; height: 273px; border-top-style: groove; border-right-style: groove; border-left-style: groove; background-color: transparent; border-bottom-style: groove;">
         <tr>
             <td style="width: 98px">
                 姓名:</td>
             <td style="text-align: left" colspan="3">
                 <input id="Text1" type="text" style="width: 155px" name="Name" /></td>
             <td style="width: 138px; text-align: left;" rowspan="3">
                 <img  src="" style="width: 91px; height: 108px" name="pic"/></td>
         </tr>
         <tr>
             <td style="width: 98px">
                 性别:</td>
             <td style="width: 80px">
                 <input id="Text2" type="text" name="Sex" style="width: 154px" /></td>
             <td style="width: 58px">
                 民族:</td>
             <td style="width: 59px">
                 <input id="Text3" type="text" name="Nation" style="width: 94px" /></td>
         </tr>
         <tr>
             <td style="width: 98px">
                 出生日期:</td>
             <td style="text-align: left;" colspan="3">
                 <input id="Text4" type="text" style="width: 151px" name="Born" /></td>
         </tr>
         <tr>
             <td style="width: 98px">
                 地址:</td>
             <td colspan="4" style="text-align: left">
                 <input id="Text5" style="width: 505px" type="text" name="Address" /></td>
         </tr>
         <tr>
             <td style="width: 98px">
                 身份号码:</td>
             <td colspan="4" style="text-align: left">
                 <input id="Text6" style="width: 506px" type="text" name="CardNo" /></td>
         </tr>
         <tr>
             <td style="width: 98px">
                 签发机关:</td>
             <td colspan="4" style="text-align: left">
                 <input id="Text7" style="width: 505px" type="text" name="IssuedAt" /></td>
         </tr>
         <tr>
             <td style="width: 98px">
                 有效期限:</td>
             <td colspan="4" style="text-align: left">
                 <input id="Text8" style="width: 163px" type="text" name="EffectedDate" />至<input id="Text10" style="width: 163px" type="text" name="ExpiredDate" /></td>
         </tr>
         <tr>
             <td style="width: 98px; text-align: left;">
                 模块号码:</td>
             <td colspan="4" style="text-align: left">
                 <input id="Text9" style="width: 506px" type="text" name="SAMID" /></td>
         </tr>
         <tr>
             <td style="width: 98px; text-align: left; height: 136px;">
                 照片编码:</td>
             <td colspan="4" style="text-align: left; height: 136px;">
                 <textarea id="TextArea1" name="Picture" style="width: 509px; height: 115px"></textarea></td>
         </tr>
         <tr><object classid="clsid:5EB842AE-5C49-4FD8-8CE9-77D4AF9FD4FF" id="IdrControl1"   width="1" height="1"></object>

<td style="width: 98px; text-align: left">
                 编码长度:</td>
             <td colspan="4" style="text-align: left">
                 <input id="Text11" style="width: 508px" type="text" name="PictureLen"/></td>
         </tr>
     </table>

</form>
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<input id="Button1" type="button" value="读   卡" οnclick="return Button1_onclick()" />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<input id="Button3" type="button" value="jl读   卡" οnclick="return Button3_onclick()" />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp;<input id="Button3" type="button" value="关   于" οnclick="return Button3_onclick()" />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

</body>
</html>

怎么在WEB页面上读取身份证信息相关推荐

  1. 浏览器使用华视电子设备读取身份证信息

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家. 对人工智能感兴趣或者想了解的小伙伴,可以点击跳转到网站一起学习哟. https://www.captainai.ne ...

  2. web读取身份证信息(java语言)

    其实实现读取身份证信息,代码其实没有多难,关键需要和硬件的厂商协调好,看他们的硬件是否支持二次开发(一般都支持).如果支持我们需要和他们拿到他们底层的jar包和api(接口文档),要是有demo就更好 ...

  3. java web统计报表_用Java在Web页面上输出统计图 统计报表

    用Java在Web页面上输出统计图 河南省焦作水利局 聂春生 在Internet 和Intranet 的应用中,数据库和Web 技术的结合是传统MIS 系统移植到Internet(Intrant) 环 ...

  4. C#使用读卡器读取身份证信息(包含物理卡号)

    说明:本人用的是精伦身份证阅读器idr210 免驱 摘要:目前市面上读取身份证技术已经很成熟了,大多数文章都介绍了读取身份证的详细信息,但是这些信息里并不包含身份证的物理卡号,所以本文讲解的重点在读取 ...

  5. 身份证读取设备开发解决方案:2、Android下通过usb转串口读取身份证信息

    身份证读取设备开发解决方案:2.Android下通过usb转串口读取身份证信息 文章目录 身份证读取设备开发解决方案:2.Android下通过usb转串口读取身份证信息 1. 前言 2. 准备 3. ...

  6. VUE实现华视身份证阅读器读取身份证信息

    VUE实现华视身份证阅读器读取身份证信息 话不多上直接上代码,写的不怎么规范多多包涵,我是在模态框实现的,在这里就只提供模态框代码. 最后附上华视身份证阅读器安装文件和浏览器插件链接: [https: ...

  7. 把当前web页面上的所有图片复制到特定目录

    把当前web页面上的所有图片复制到特定目录,比如C:/imgs/ 转载请注明:作者:糯米糊糊(huyoo353),来源:http://blog.csdn.net/huyoo/ MoreQuick回复: ...

  8. 用python读取身份证信息的功能分析与实现,兼述python调用dll的方法

    背景 有这样一个需求,要求能自动读取用户的身份证信息.如果是一代身份证,这个功能恐怕只能通过图像识别的办法来解决了.不过现在二代身份证已经很普及.客户要求能读二代身份证就可以了. 现在二代身份证阅读器 ...

  9. 如何在Web页面上直接打开、编辑、创建Office文档 (转载)

    有朋友询问如何在Web页面上做到像SharePoint中的效果一样,能直接激活客户端的Word来打开.doc文件,而不是类似直接点击.doc文档链接时Word在IE中被打开那样.想想这个问题应该很多人 ...

最新文章

  1. @WebInitParam注解
  2. c# 找出目录下的所有子目录_Linux操作系统文件目录
  3. SQL Server报错:选择列表中的列无效,因为该列没有包含在聚合函数或 GROUP BY 子句中...
  4. java.util.concurrent介绍【转】
  5. 在tsx中引入less会提示模块找不到,但是可以运行
  6. python 小说 云_python小说网站
  7. oracle dba角色_DBA在“即服务”世界中角色的不断变化
  8. 为什么今年好多人开始买基金了,是疫情影响的吗?
  9. SpringBoot + Kafka + ELK 完成海量日志收集(超详细)
  10. [2018.11.05 T3] 零食
  11. 常见的激励函数和损失函数
  12. 江苏计算机二级msoffice高级应用,计算机二级考试MSOffice高级应用
  13. java-枚举类的定义及使用
  14. x79主板不支持服务器内存条,x79主板支持什么内存
  15. 用计算机弹生日歌,神秘操作!吴丹妮酷狗直播竟用计算器唱生日歌!
  16. 切线空间(Tangent Space) 的计算与应用
  17. 【AGC035F】Two Histograms
  18. 爬取斗鱼直播平台的所有房间信息
  19. word启动时出现运行时错误 未注册类弹窗问题
  20. JSON 数据结构、数据格式

热门文章

  1. ubuntu 11.10安装及配置
  2. Zemax,LightTools中LED光源设置总结
  3. 小程序中图片点击预览、长按识别图中二维码的问题
  4. Oracle 比较两列字段的值是否相同
  5. XSS攻击和CSRF攻击(浅显易懂)
  6. SMMU架构手册之数据结构和转换流程(3)
  7. c java python用于什么_很火的Java、Python、C、C++、PHP各有什么用途?一文帶你了解...
  8. Capture One Pro 21 for Mac(RAW图像处理软件)
  9. matlab阻抗控制仿真,机械臂阻抗控制与仿真研究.PDF
  10. 《机械制造业智能工厂规划设计》——第3章 机械制造业智能工厂的总体框架 3.1 智能制造的通用定义和特征...