English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
可直接复制粘贴运行 带生成身份证号码功能
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script src="http://demo.js.jdk5.com/jquery-1.12.3.min.js"></script> <script type="text/javascript" src="http://demo.js.jdk5.com/IDValidator/IDValidator.js" charset="utf-8" ></script> <script type="text/javascript" src="http://demo.js.jdk5.com/IDValidator/GB2260.js" charset="utf-8" ></script> <title>Insert title here</title> <style type="text/css"> div{margin: 20px;} </style> <script type="text/javascript"> //Create a general instance var Validator = new IDValidator(); //Or use an instance with an address code, you need to import GB2260 //var Validator = IDValidator(GB2260); $(function (){ $("#isValid-btn").click(function (){ //Verify whether the number is valid, return true if valid, and return false if invalid var code = $("#isValid").val(); var i = Validator.isValid(code); $("#isValid-show").html(i == false &63; "Invalid number" : "Valid number" }); $("#getInfo-btn").click(function (){ //When the number is valid, return the analysis information (area, birth date, gender, check digit), and return false if it is invalid var code = $("#getInfo").val(); var i = Validator.getInfo(code); $("#getInfo-show").html(i == false &63; "Invalid number" : JSON.stringify(i)); }); $("#makeID18-btn").click(function (){ //Make a fake18ID number $("#makeID18-show").html(Validator.makeID()); }); $("#makeID15-btn").click(function (){ //Make a fake15ID number $("#makeID15-show").html(Validator.makeID(true)); }); }); </script> </head> <body> <div> <input id="isValid" /> <button id="isValid-btn">Check if valid</button> <div id="isValid-show></div> </div> <div> <input id="getInfo" /> <button id="getInfo-btn">ID card details</button> <div id="getInfo-show></div> </div> <div> <button id="makeID18-btn">Make a fake18ID number</button> <div id="makeID18-show></div> </div> <div> <button id="makeID15-btn">Make a fake15ID number</button> <div id="makeID15-show></div> </div> </body> </html>
The above-mentioned is the JS implementation of the validity verification of Chinese citizen ID number introduced by the editor to everyone, hoping it will be helpful to everyone. If you have any questions, please leave a message, and the editor will reply to everyone in time. Thank you very much for your support of the Yell Tutorial website!
Declaration: The content of this article is from the network, the copyright belongs to the original author, the content is contributed and uploaded by Internet users spontaneously, this website does not own the copyright, has not been edited by humans, and does not bear relevant legal liability. If you find any content suspected of copyright infringement, please send an email to: notice#oldtoolbag.com (Please replace # with @ when sending an email for reporting, and provide relevant evidence. Once verified, this site will immediately delete the content suspected of infringement.)