try{ var i=0; var et = new ActiveXObject("CheckUSBCom.ETCheckUSB.1"); var result = 0; function startUSBCheck() { result = et.ET_Monitor(); if((result == 0) && (i == 0)) { //document.getElementById('txt').innerHTML="not exist"; i = 0; //alert("请插入加密锁!") //return false; } if((result == 3) && (i == 0)) { //document.getElementById('txt').innerHTML="insert2"; i = 1; Init(); } if((result == 1) && (i == 0)) { //document.getElementById('txt').innerHTML="insert1"; Init(); i = 1; } if((result == 2) && (i == 1)) { //document.getElementById('txt').innerHTML="remove"; i = 0; } tidck = setTimeout('startUSBCheck()',500); } }catch(e){ alert('没有安装ActiveX控件,点击确定安装'); window.location.href='yucioa_update.exe'; } function Init() { var ePassSN; var ePassDigest; var UserID; var ePassPID; var ePassNum; var ePass = new ActiveXObject("ET99_FULL.ET99Full.1"); //找锁 ePassPID = "F737F785"; ePassNum = ePass.FindToken(ePassPID); //打开锁 ePass.OpenToken(ePassPID,1); //验证UserPIN ePass.VerifyPIN(0,"FFFFFFFFFFFFFFFFFF"); //读出用户名 UserID = ePass.Read(0,0,10); //办事处 UserID1 = ePass.Read(0,10,10); //社区 frmxx.usb_banshichuname.value=UserID; frmxx.usb_shequname.value=UserID1; ePass.CloseToken(); }