Skip to main content

✅ | ID-Cal.php

Here's a page that calculates your last ID Number, which will process your data locally

<html>
<head>
    <title>身份证号码推导</title>
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=0.7">
    <style>
        @media (max-width: 980px) {
          body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #007eca;
          }
        }
        @media (min-width: 981px) {
          body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #007eca;
            background-image: url("https://dl.itslittlekevin.com/projects/5069.png");
            background-repeat: no-repeat;
            background-position: right center;
            background-size: auto 100%;
          }
        }
        h1, p, h4 {
          text-shadow: 2px 2px 2px #00000055;
        }
        * {
            color: white;
        }
        button {
            font-size: 15px;
            background-color: #00325565;
            padding: 5px 15px;
            border-radius: 5px;
            border-width: 0px;
            margin: 5px;
            cursor: pointer;
        }
        h4 a {
            text-decoration: none;
        }
        input{
            color: black;
            margin: 10px;
            border-radius: 5px;
            padding: 5px 15px
        }
        .button {
            font-size: 16px;
            margin-top: 10px;
            color: black;
        }
        .center {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
        }

    </style>
    <script>
        var arr = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
        var code = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
        function derive() {
            var id = document.getElementById('id').value;
            if (id.length != 17) {
                alert("请输入17位身份证号码!");
                return false;
            }
            var idArr = id.split("");
            var sum = 0;
            for (var i = 0; i < 17; i++) {
                sum += idArr[i] * arr[i];
            }
            var remainder = sum % 11;
            var checkCode = code[remainder];
            alert("第十八位应该是" + checkCode);
            return true;
        }
    </script>
</head>
<body>
    <div class="center">
        <h1>身份证号码推导</h1>
        <p>输入身份证号码前十七位:</p>
        <p>本页面只在本地运算<br
        >没有数据回传至服务器</p>
        <input type="text" id="id" maxlength="17" placeholder="00088869697878123">
        <button onclick="derive()">推导</button>
        <h4><a href="https://itslittlekevin.com/gadgetslist">»返回工具列表 | Return to Gadgets List«</a></h4>
        <p>© itsLittleKevin · All rights reserved.</p>
    </div>

</body>
</html>