JavaScript读写T5557卡源码

2023-12-25 17:39:20

本示例使用发卡器:?https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-21818769070.13.48ce6f89XlQ9Vf&id=675212889085

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>T5557读写器DEMO</title>

    <script language="javascript">
		
		window.onload = function() {
   			document.getElementById('textcarduid').hidden=true;
			document.getElementById('textauthkey').hidden=true;
			document.getElementById('initkey').hidden=true;			
			document.getElementById('nodeinf').hidden=true;			
        }

        var iswsrun = false;
        var ws;
        var received_msg = "";
        var mytimer;
        var strls = "";
        var errorno = "";

        var wsUri = "ws://127.0.0.1:39189";   //端口号必须与RFIDWebServer端口一致
				
        function isUIntNum(val) {
            var testval = /^\d+$/; // 非负整数
            return (testval.test(val));
        }

        function isHex(val) {
            var testval = /^(\d|[A-F]|[a-f])+$/; // 十六进制数判断
            return (testval.test(val));
        }							

        function beep() {				     //驱动发卡器响声令
            textarea.value = "";		
            WebSocketRun("idr_beep,30");	 //30为响声时长豪秒,取值范围1-65535
        }
		
        function getdevicenumber() {         //读取发卡器唯一出厂序号,可以当加密狗使用			
            textarea.value = "";		
			serialnumber.value="";
            WebSocketRun("IDpcdgetdevicenumber");			
        }		
		
        function ReadID() {					//卡片在感应区内可以连续读取卡号
            textarea.value = "";
			carduid.value="";			
			Vendorcode.value="";
			card8h10dz.value="";
			card8h10df.value="";
			cardwg26z.value="";
			cardwg34z.value="";
            WebSocketRun("idr_read,");
        }			
		
        function ReadIDOne() {				//卡片进入感应区内只可读取一次卡号,再次读取需将卡片移开再次放入感应区
            textarea.value = "";
			carduid.value="";			
			Vendorcode.value="";
			card8h10dz.value="";
			card8h10df.value="";
			cardwg26z.value="";
			cardwg34z.value="";
            WebSocketRun("idr_read_once,");
        }						
		
        function t5557_read() {
            textarea.value = "";
			 RWdata.value="";
			
			myctrlword = 0;                     //控制字,只对指定系列号的卡操作+1,需要用密码认证+2,写卡后要锁定配置块或数据块+4,启用本卡的密码功能+8,操作成功后重启卡片+16
			if (checkauthkey.checked) {
				mypicckey= textauthkey.value.trim();            //指定要读写卡的认证密钥
				myctrlword=myctrlword+2;
				if (!isHex(mypicckey) || mypicckey.length!=8) {
					alert( "卡片认证密钥输入错误,请输入8位16进制认证密钥!");
					textauthkey.focus();
					textauthkey.select();
					return;
				}				
			}else{
				mypicckey = "00000000";             //t5557卡密码为4个字节,卡出厂时密码功能不启用,无需密码也能读写卡	
			}
			
			if (checkuid.checked) {
				mypiccserial= textcarduid.value.trim();            //指定要读写卡的UID
				if (!isHex(mypiccserial) || mypiccserial.length!=12) {
					alert( "UID输入错误,请输入正确的12位16进制卡片UID!");
					textcarduid.focus();
					textcarduid.select();
					return;
				}		
				if (mypiccserial!="000000000000"){myctrlword=myctrlword+1;}		
			}else{
				mypiccserial = "000000000000";      //读任意卡,t5557卡UID6个字节
			}
			
			//总计8位二进制数,从右1到左分别表示T5557卡第0页 第0块到第7块的地址是否选取,为1表示选择读,为0 表示不读
			if (checkblock0.checked){mypiccblockflag="1";}else{mypiccblockflag="0";}
			if (checkblock1.checked){mypiccblockflag="1"+mypiccblockflag;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock2.checked){mypiccblockflag="1"+mypiccblockflag;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock3.checked){mypiccblockflag="1"+mypiccblockflag;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock4.checked){mypiccblockflag="1"+mypiccblockflag;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock5.checked){mypiccblockflag="1"+mypiccblockflag;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock6.checked){mypiccblockflag="1"+mypiccblockflag;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock7.checked){mypiccblockflag="1"+mypiccblockflag;}else{mypiccblockflag="0"+mypiccblockflag;}
						
		    //总计8位二进制数,最右边1位取0,从右2到左分别表示T5557卡第1页 第0块到第3块块地址是否选取,T5557第一页只有0、1两个块,T5567、T5577有0、1、2、3四个块				
			mypiccblockflag=mypiccblockflag+"000";			
			if (checkblock23.checked){mypiccblockflag=mypiccblockflag+"1";}else{mypiccblockflag=mypiccblockflag+"0";}			
			if (checkblock22.checked){mypiccblockflag=mypiccblockflag+"1";}else{mypiccblockflag=mypiccblockflag+"0";}			
			if (checkblock21.checked){mypiccblockflag=mypiccblockflag+"1";}else{mypiccblockflag=mypiccblockflag+"0";}	
			if (checkblock20.checked){mypiccblockflag=mypiccblockflag+"1";}else{mypiccblockflag=mypiccblockflag+"0";}					
			mypiccblockflag=mypiccblockflag+"0";            
			
			if (mypiccblockflag=="0000000000000000"){
				alert( "未选择操作块,请选择要读的块!");
				return;
			}

            var Readt5557Comm = "t5557_read," + myctrlword + "," + mypiccserial + "," + mypicckey + "," + mypiccblockflag;
            WebSocketRun(Readt5557Comm);
        }	
		
        function t5557_write() {
            textarea.value = "";
			
			myctrlword = 0;                     //控制字,只对指定系列号的卡操作+1,需要用密码认证+2,写卡后要锁定配置块或数据块+4,启用本卡的密码功能+8,操作成功后重启卡片+16
			if (checkauthkey.checked) {
				mypicckey= textauthkey.value.trim();            //指定要读写卡的认证密钥
				myctrlword=myctrlword+2;
				if (!isHex(mypicckey) || mypicckey.length!=8) {
					alert( "卡片认证密钥输入错误,请输入8位16进制认证密钥!");
					textauthkey.focus();
					textauthkey.select();
					return;
				}				
			}else{
				mypicckey = "00000000";             //t5557卡密码为4个字节,卡出厂时密码功能不启用,无需密码也能读写卡	
			}
			
			if (checkuid.checked) {
				mypiccserial= textcarduid.value.trim();            //指定要读写卡的UID
				if (!isHex(mypiccserial) || mypiccserial.length!=12) {
					alert( "UID输入错误,请输入12位16进制UID!");
					textcarduid.focus();
					textcarduid.select();
					return;
				}		
				if (mypiccserial!="000000000000"){myctrlword=myctrlword+1;}		
			}else{
				mypiccserial = "000000000000";      //读任意卡,t5557卡UID6个字节
			}
			
			//总计8位二进制数,从右1到左分别表示T5557卡第0页 第0块到第7块的地址是否选取,为1表示选择读,为0 表示不读
			blocks=0;
			if (checkblock0.checked){mypiccblockflag="1";blocks=blocks+1;}else{mypiccblockflag="0";}
			if (checkblock1.checked){mypiccblockflag="1"+mypiccblockflag;blocks=blocks+1;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock2.checked){mypiccblockflag="1"+mypiccblockflag;blocks=blocks+1;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock3.checked){mypiccblockflag="1"+mypiccblockflag;blocks=blocks+1;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock4.checked){mypiccblockflag="1"+mypiccblockflag;blocks=blocks+1;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock5.checked){mypiccblockflag="1"+mypiccblockflag;blocks=blocks+1;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock6.checked){mypiccblockflag="1"+mypiccblockflag;blocks=blocks+1;}else{mypiccblockflag="0"+mypiccblockflag;}
			if (checkblock7.checked){mypiccblockflag="1"+mypiccblockflag;blocks=blocks+1;}else{mypiccblockflag="0"+mypiccblockflag;}
						
		    //总计8位二进制数,最右边1位取0,从右2到左分别表示T5557卡第1页 第0块到第3块块地址是否选取,T5557第一页只有0、1两个块,T5567、T5577有0、1、2、3四个块				
			mypiccblockflag=mypiccblockflag+"000";			
			if (checkblock23.checked){mypiccblockflag=mypiccblockflag+"1";blocks=blocks+1;}else{mypiccblockflag=mypiccblockflag+"0";}			
			if (checkblock22.checked){mypiccblockflag=mypiccblockflag+"1";blocks=blocks+1;}else{mypiccblockflag=mypiccblockflag+"0";}			
			if (checkblock21.checked){mypiccblockflag=mypiccblockflag+"1";blocks=blocks+1;}else{mypiccblockflag=mypiccblockflag+"0";}	
			if (checkblock20.checked){mypiccblockflag=mypiccblockflag+"1";blocks=blocks+1;}else{mypiccblockflag=mypiccblockflag+"0";}					
			mypiccblockflag=mypiccblockflag+"0";            
			
			if (mypiccblockflag=="0000000000000000"){
				alert( "未选择操作块,请选择要写的块!");
				return;
			}

            //数据
            strls = RWdata.value.trim();
            if (!isHex(strls)  || strls.length<blocks*8) {
                alert( "写数据输入错误,请输入"+(blocks*8).toString()+"位16进制写卡数据!");
                RWdata.focus();
                RWdata.select();
                return;
            }

            var Writet5557Comm = "t5557_write," + myctrlword + "," + mypiccserial + "," + mypicckey + "," + mypiccblockflag + "," + strls;
            WebSocketRun(Writet5557Comm);
        }	
		
        function t5557_init() {
            textarea.value = "";
			
			myctrlword = 0;                     //控制字,只对指定系列号的卡操作+1,需要用密码认证+2,写卡后要锁定配置块或数据块+4,启用本卡的密码功能+8,操作成功后重启卡片+16
			if (checkauthkey.checked) {
				mypicckey= textauthkey.value.trim();            //指定要读写卡的认证密钥
				myctrlword=myctrlword+2;
				if (!isHex(mypicckey) || mypicckey.length!=8) {
					alert( "卡片认证密钥输入错误,请输入8位16进制认证密钥!");
					textauthkey.focus();
					textauthkey.select();
					return;
				}				
			}else{
				mypicckey = "00000000";             //t5557卡密码为4个字节,卡出厂时密码功能不启用,无需密码也能读写卡	
			}
			
			if (checkuid.checked) {
				mypiccserial= textcarduid.value.trim();            //指定要读写卡的UID
				if (!isHex(mypiccserial) || mypiccserial.length!=12) {
					alert( "UID输入错误,请输入正确的12位16进制卡片UID!");
					textcarduid.focus();
					textcarduid.select();
					return;
				}		
				if (mypiccserial!="000000000000"){myctrlword=myctrlword+1;}		
			}else{
				mypiccserial = "000000000000";      //读任意卡,t5557卡UID6个字节
			}
			
            if (checkconfig.checked)                       //新配置开启密码保护
            {
                myctrlword = myctrlword + 8;
                mynewkey = initkey.value.trim();
                if (!isHex(mynewkey) || mynewkey.length!=8) {
                    alert("卡密钥输入错误,请输入8位16进制卡密钥!");
                    initkey.focus();
                    initkey.select();
                    return;
                }
            }else{mynewkey = "00000000";}

			myconfig = textconf.value.trim();
            if (!isHex(myconfig) || myconfig.length!=8) {
                alert("卡片配置值输入错误,请输入8位16进制卡片配置值!");
                textconf.focus();
                textconf.select();
                return;
            }

            var initt5557Comm = "t5557_init," + myctrlword + "," + mypiccserial + "," + mypicckey + "," + myconfig + "," + mynewkey;
            WebSocketRun(initt5557Comm);
        }		
		
        function t5557_changekey() {
            textarea.value = "";
			
			myctrlword = 0;                     //控制字,只对指定系列号的卡操作+1,需要用密码认证+2,写卡后要锁定配置块或数据块+4,启用本卡的密码功能+8,操作成功后重启卡片+16
			if (checkauthkey.checked) {
				mypicckey= textauthkey.value.trim();            //指定要读写卡的认证密钥
				myctrlword=myctrlword+2;
				if (!isHex(mypicckey) || mypicckey.length!=8) {
					alert( "卡片认证密钥输入错误,请输入8位16进制认证密钥!");
					textauthkey.focus();
					textauthkey.select();
					return;
				}				
			}else{
				mypicckey = "00000000";             //t5557卡密码为4个字节,卡出厂时密码功能不启用,无需密码也能读写卡	
			}
			
			if (checkuid.checked) {
				mypiccserial= textcarduid.value.trim();            //指定要读写卡的UID
				if (!isHex(mypiccserial) || mypiccserial.length!=12) {
					alert( "UID输入错误,请输入正确的12位16进制卡片UID!");
					textcarduid.focus();
					textcarduid.select();
					return;
				}		
				if (mypiccserial!="000000000000"){myctrlword=myctrlword+1;}		
			}else{
				mypiccserial = "000000000000";      //读任意卡,t5557卡UID6个字节
			}

            mynewkey = textnewkey.value.trim();
            if (!isHex(mynewkey) || mynewkey.length!=8) {
                alert("新密钥输入错误,请输入8位16进制新密钥!");
                textnewkey.focus();
                textnewkey.select();
                return;
            }

            var Writet5557Comm = "t5557_changekey," + myctrlword + "," + mypiccserial + "," + mypicckey + "," + mynewkey;
            WebSocketRun(Writet5557Comm);
        }			
		
		function selechanguid(){
			var t = document.getElementById('textcarduid');
			if (checkuid.checked){				
                document.getElementById('textcarduid').hidden=false; 
			}else{document.getElementById('textcarduid').hidden=true; }				
		}
		
		function selecheckauthkey(){			
			if (checkauthkey.checked){				
                document.getElementById('textauthkey').hidden=false; 
			}else{document.getElementById('textauthkey').hidden=true; }			
		}
		
		function selechangeinit(){
			if (checkconfig.checked){				
                document.getElementById('initkey').hidden=false; 
				document.getElementById('nodeinf').hidden=false;		
				document.getElementById('textconf').value='00088038';
			}else{	
				document.getElementById('initkey').hidden=true; 
				document.getElementById('nodeinf').hidden=true;		
				document.getElementById('textconf').value='00088028';
			}						
		}
		
		function DispErrInfo(errcode){
            var errstr = "";
            switch (errcode) {
				case "ReturnCode:001":
                    errstr = ",写入配置的值不正确,请重新写入!";
                    break;
                case "ReturnCode:002":
                    errstr = ",本卡尚未开启密码功能,请不要勾选带密钥操作,函数myctrlword不要加2!";
                    break;
                case "ReturnCode:003":
                    errstr = ",需要密码才能读写卡,请选择带密钥操作,函数myctrlword要加2!";
                    break;
                case "ReturnCode:005":
                    errstr = ",密码错误!";
                    break;				
                case "ReturnCode:008":
                    errstr = ",未寻到卡,请重新将卡放到发卡器的感应区!";
                    break;
                case "ReturnCode:021":
                    errstr = ",没有动态库!";
                    break;
                case "ReturnCode:022":
                    errstr = ",动态库或驱动程序异常!";
                    break;
                case "ReturnCode:023":
                    errstr = ",驱动程序错误或发卡器未连接!";
                    break;
                case "ReturnCode:024":
                    errstr = ",操作超时,一般是动态库没有反映!";
                    break;
                case "ReturnCode:025":
                    errstr = ",发送字数不够!";
                    break;
                case "ReturnCode:026":
                    errstr = ",发送的CRC错!";
                    break;
                case "ReturnCode:027":
                    errstr = ",接收的字数不够!";
                    break;
                case "ReturnCode:028":
                    errstr = ",接收的CRC错!";
                    break;
                case "ReturnCode:029":
                    errstr = ",函数输入参数格式错误!";
                    break;
                case "ReturnCode:444":
                    errstr = ",RFIDWebServer系统文件错误!";
                    break;
                default:
                    errstr = ",未知的错误!";
            }
            return errstr;
		}			
		
		
        window.onerror = function (e) {
            alert("不好意思,出错了!");
            return true;//屏蔽系统事件
        }

        function timeoutevent() {
            ws.close();
            textarea.value = "websockket返回超时";
        }

        //websockket数据处理
        function WebSocketRev(evt) {
            clearTimeout(mytimer);
            received_msg = evt.data;
            ws.close();

            //在这里解析返回数据
            var strlist = received_msg.split(",");
            if (strlist.length > 1) {
                var dispstr = "";
                switch (strlist[0]) {
                    case "idr_beep":
                        dispstr = "函数名称:" + strlist[0] + "\r\n";
                        if (strlist[1] == "ReturnCode:000") {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + ",已执行蜂鸣响声操作!\r\n"
                        } else {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + DispErrInfo(strlist[1]);
                        }
                        textarea.value = dispstr;
                        break;

                    case "pcdgetdevicenumber":
                        dispstr = "函数名称:" + strlist[0] + "\r\n";
                        if (strlist[1] == "ReturnCode:000") {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + ",已读取设备编号!\r\n"
							serialnumber.value =  strlist[2] ;
                        } else {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + DispErrInfo(strlist[1]);
                        }
                        textarea.value = dispstr;
                        break;

                    case "idr_read":
                    case "idr_read_once":
                        dispstr = "函数名称:" + strlist[0] + "\r\n";
                        if (strlist[1] == "ReturnCode:000") {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + ",已读取卡号!\r\n"
							
                        } else {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + DispErrInfo(strlist[1]);
                        }
                        if (strlist.length > 2) {
                            carduid.value=strlist[2] ;
							Vendorcode.value=strlist[2].substring(0,2);
							
							HLCode=strlist[2].substring(2,4)+strlist[2].substring(4,6)+strlist[2].substring(6,8)+strlist[2].substring(8,10);
							card8h10dz.value=parseInt("0x"+HLCode).toString().padStart(10, '0');
							
							LHCode=strlist[2].substring(8,10)+strlist[2].substring(6,8)+strlist[2].substring(4,6)+strlist[2].substring(2,4);
							card8h10df.value=parseInt("0x"+LHCode).toString().padStart(10, '0');
							
							cardwg26z.value=parseInt("0x"+strlist[2].substring(4,6)).toString().padStart(3, '0')+parseInt("0x"+strlist[2].substring(6,10)).toString().padStart(5, '0');
							cardwg34z.value=parseInt("0x"+strlist[2].substring(2,6)).toString().padStart(5, '0')+parseInt("0x"+strlist[2].substring(6,10)).toString().padStart(5, '0');							
                        }
                        textarea.value = dispstr;
                        break;	
						
                    case "t5557_read":
                        dispstr = "函数名称:" + strlist[0] + "\r\n";
                        if (strlist[1] == "ReturnCode:000") {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + ",已读取卡内数据!\r\n";
                        } else {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + DispErrInfo(strlist[1]);
                        }
                        if (strlist.length > 2) {
                            dispstr = dispstr + "卡序列号:" + strlist[2] + "\r\n";
                        }
                        if (strlist.length > 3) {
                            RWdata.value =  strlist[3] ;
                        }
                        if (strlist.length > 4) {
                            dispstr = dispstr + "卡无线转输分频比:" + strlist[4] + "\r\n";
                        }
                        textarea.value = dispstr;
                        break;	
						
                    case "t5557_write":
                    case "t5557_changekey":
                    case "t5557_init":
                        dispstr = "函数名称:" + strlist[0] + "\r\n";
                        if (strlist[1] == "ReturnCode:000") {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + ",写卡成功!\r\n"
                        } else {
                            dispstr = dispstr + "操作结果:" + strlist[1];
                            dispstr = dispstr + DispErrInfo(strlist[1]);
                        }
                        if (strlist.length > 2) {
                            dispstr = dispstr + "卡序列号:" + strlist[2] + "\r\n";
                        }
                        textarea.value = dispstr;
                        break;																
																									
                }
            }
        }		
		
        function WebSocketRun(sendinfo) {
            iswsrun = false;

            try {
                if ("WebSocket" in window) {
                    ws = new WebSocket(wsUri);
                }
                else if ("MozWebSocket" in window) {
                    ws = new MozWebSocket(wsUri);
                }
                else {
                    received_msg = "您的浏览器不支持WebSocket,请选用支持WebSocket的浏览器!";
                    return;
                }

                clearTimeout(mytimer);

                ws.onopen = function (evt) {
                    ws.send(sendinfo);
                    iswsrun = true;

                    mytimer = setTimeout("timeoutevent()", 2000);
                };

                ws.onmessage = WebSocketRev;

                ws.onerror = function (e) {
                    if (iswsrun != true) {
                        received_msg = "请先在当前电脑下载>安装>运行我们的服务程序......";
                        window.open("http://www.icmcu.com/ICID15693-02V2test/RFIDWebServerSetup.exe", "top");//打开新窗口

                        alert("请先下载>安装>运行我们的服务程序,再刷新本页面......");
                    }
                };
            }
            catch (ex) {
                if (iswsrun != true) {
                    received_msg = "请先在当前电脑下载>安装>运行我们的服务程序......";
                    window.open("http://www.icmcu.com/ICID15693-02V2test/RFIDWebServerSetup.exe", "top");//打开新窗口

                    alert("请先下载>安装>运行我们的服务程序,再刷新本页面......");
                }
            }
        }
				
	</script>
    
	<style>
		th {
		  font-family:楷体;
		  background-color:#F5F5F5;		
		  color:blue;
		}
		td {
		  font-family:楷体;
		  background-color:#F5F5F5;		
		}  
    </style>        
    
</head>

<body>
<table width="866" height="640" border="1" align="center">
  <tr>
    <th width="124" height="47" scope="row"><input name="butt_beep" type="submit" id="butt_beep" onclick="beep()" value="驱动发卡器响声" /></th>
    <td width="716"><input name="butt_getdevnum" type="submit" id="butt_getdevnum" onclick="getdevicenumber()" value="读取发卡器唯一出厂序列号" />
      设备编号:
        <input style="color:red;text-align:center;" name="serialnumber" type="text" id="serialnumber" size="8" maxlength="8" />
    </td>
  </tr>
  
  <tr>
    <th height="67" scope="row"><p>&nbsp;</p></th>
    <td><p>
        <input name="checkauthkey" type="checkbox" id="checkauthkey" onchange="selecheckauthkey()" value="" />
      选择带密钥操作,8位16进制卡片认证密钥:
      <input style="color:blue;text-align:center;" name="textauthkey" type="text" id="textauthkey" value="00000000" size="8" maxlength="8" onkeyup="this.value=this.value.replace(/[^0-9a-fA-F]/g,'')"/><br />
      <input name="checkuid" type="checkbox" id="checkuid" onchange="selechanguid()" value="" />
      选择只操作指定ID的卡,12位16进制UID:
      <input style="color:blue;text-align:center;" name="textcarduid" type="text" id="textcarduid" value="000000000000" size="12" maxlength="12" onkeyup="this.value=this.value.replace(/[^0-9a-fA-F]/g,'')"/>
    </p>
    <table width="723" height="200" border="1">
      <tr>
        <td height="196"><label style="color:blue;">第0页:</label>
          <label style="color:red;" ><br />
            <br />
            <input name="checkblock0" type="checkbox" id="checkblock0" checked="checked" />
            第0块,配置块,只能读需用特殊指令写<br />
          </label>
          <label>
            <input name="checkblock1" type="checkbox" id="checkblock1" checked="checked" />
            第1块,用户数据块,可读写<br />
          </label>
          <label>
            <input name="checkblock2" type="checkbox" id="checkblock2" checked="checked" />
            第2块,用户数据块,可读写<br />
          </label>
          <label>
            <input name="checkblock3" type="checkbox" id="checkblock3" checked="checked" />
            第3块,用户数据块,可读写<br />
          </label>
          <label>
            <input name="checkblock4" type="checkbox" id="checkblock4" checked="checked" />
            第4块,用户数据块,可读写<br />
          </label>
          <label>
            <input name="checkblock5" type="checkbox" id="checkblock5" checked="checked" />
            第5块,用户数据块,可读写<br />
          </label>
          <label>
            <input name="checkblock6" type="checkbox" id="checkblock6" checked="checked" />
            第6块,用户数据块,可读写<br />
          </label>
          <label style="color:blue;">
            <input name="checkblock7" type="checkbox" id="checkblock7" checked="checked" />
          第7块,密钥或数据块,由配置值决定</label></td>
        <td><Label style="color:blue;">第1页:</label>
          <label><br />
            <br />
            <input name="checkblock20" type="checkbox" id="checkblock20" />
            第0块,可追溯数据块,只能读<br />
          </label>
          <label>
            <input name="checkblock21" type="checkbox" id="checkblock21" />
            第1块,可追溯数据块,只能读<br />
          </label>
          <label>
            <input name="checkblock22" type="checkbox" id="checkblock22" />
            第2块,可追溯数据块,只能读<br />
          </label>
          <label>
            <input name="checkblock23" type="checkbox" id="checkblock23" />
            第3块,可追溯数据块,只能读<br /><br /><br /><br />           
          </label>
          <label style="color:blue;"> t5557此页有0、1两块,t5567、t5577此页有四块</label>
          </td>
      </tr>
    </table></td>
  </tr>  
  
  <tr>
    <th width="124" height="48" scope="row"><input name="button" type="submit" id="butt_writeconfig" onclick="t5557_init()" value="设置T5557卡配置" /></th>
    <td width="716"><p>
        <input name="checkconfig" type="checkbox" id="checkconfig" onchange="selechangeinit()" value="" />
      选择开启卡片密钥保护机制,8位16进制卡密钥
      <input style="color:blue;text-align:center;" name="initkey" type="text" id="initkey" value="00000000" size="8" maxlength="8" onkeyup="this.value=this.value.replace(/[^0-9a-fA-F]/g,'')"/> <label style="color:red;" id="nodeinf" for="nodeinf">,请务必记住卡片密钥!</label> <br />
      卡片配置值:
      <input name="textconf" type="text" id="textconf" style="color:blue;text-align:center" value="00088028" size="8" maxlength="8" onkeyup="this.value=this.value.replace(/[^0-9a-fA-F]/g,'')"/>
      <label style="color:red;text-align: right">,请确保写入卡片的配置值正确,否则卡片将报废!无法读写的卡片可先设置默认值后再试试。</label>
    </p></td>
  </tr>
  
  <tr>
    <th width="124" height="48" scope="row"><input name="button3" type="submit" id="button" onclick="t5557_changekey()" value="修改T5557卡密钥" /></th>
    <td width="716"><p>新密钥:
      <input style="color:blue;text-align:center;" name="textfield" type="text" id="textnewkey" value="00000000" size="8" maxlength="8" onkeyup="this.value=this.value.replace(/[^0-9a-fA-F]/g,'')"/> <label style="color:red;"  for="nodeinf2">,请务必记住卡片新密钥!</label>
    </p></td>
  </tr>  
  
  <tr>
    <th width="124" height="52" scope="row"><p>
      <input name="button2" type="submit" id="butt_read75557" onclick="t5557_read()" value="轻松读T5557卡" /><br /><br />
      <input name="butt_t5557_write" type="submit" id="butt_t5557_write" onclick="t5557_write()" value="轻松写T5557卡" />
    </p></th>
    <td width="716"><textarea style="color:red;" name="RWdata" id="RWdata" cols="100" rows="4" onkeyup="this.value=this.value.replace(/[^0-9a-fA-F]/g,'')"></textarea></td>
  </tr>
  
  <tr>
    <th height="68" scope="row"><p>
      <input name="butt_idr_read" type="submit" id="butt_idr_read" onclick="ReadID()" value="读取4100ID卡号" />
    </p></th>
    <td><p>原始16进制卡号:
        <input style="color:red;text-align:center;" name="carduid" type="text" id="carduid" size="10" maxlength="10" />
      ,厂商代码:
      <input style="color:red;text-align:center;" name="Vendorcode" type="text" id="Vendorcode" size="2" maxlength="2" />
    ,转8H10D反码:
        <input style="color:red;text-align:center;" name="card8h10df" type="text" id="card8h10df" size="10" maxlength="10" />
    </p>
      <p>转8H10D正码:
  <input style="color:red;text-align:center;" name="card8h10dz" type="text" id="card8h10dz" size="10" maxlength="10" />
        ,转WG26正码:
        <input style="color:red;text-align:center;" name="cardwg26z" type="text" id="cardwg26z" size="10" maxlength="10" />
        ,转WG34正码:
        <input style="color:red;text-align:center;" name="cardwg34z" type="text" id="cardwg34z" size="10" maxlength="10" />
    </p></td>
  </tr>
  
  <tr>
    <th height="78" scope="row"><p>操作提示</p></th>
    <td><textarea style="color:blue;" name="textarea" id="textarea" cols="100" rows="5" ></textarea></td>
  </tr>
</table>
</body>
</html>

文章来源:https://blog.csdn.net/zhangjin7422/article/details/135201095
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。