layui身份证号码及姓名生成器代码

代码语言:html

所属分类:其他

代码描述:layui身份证号码及姓名生成器代码,可选择省市区、出生年月、性别、姓名数据,注意不能用于非法目的。

代码标签: layui 身份证 号码 姓名 生成器 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>身份信息生成器</title>
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/layui.2.9.10.css">
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/layui.2.9.10.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/GB2260.js"></script>

</head>

<body>
    <div class="layui-container" style="margin-top: 20px;">
        <form class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">出生地</label>
                <div class="layui-input-inline">
                    <select name="province" id="province" lay-filter="province">
                        
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="city" id="city" lay-filter="city">
                        
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="district" id="district">
                       
                    </select>
                </div>
            </div>

            <div class="layui-form-item" >
                <label class="layui-form-label">出生日期</label>
                <div class="layui-input-block">
                    <input type="radio" name="dateType" value="specific" title="指定日期"  lay-filter="dateType">
                   
                    <input type="radio" checked name="dateType" value="random" title="随机" lay-filter="dateType">
                </div>
            </div>

            <div class="layui-form-item" id="datechoose" style="display:none;">
                <label class="layui-form-label">日期</label>
                <div class="layui-input-inline" style="width: 100px;">
                  <input type="text"  name="datetime" class="layui-input" id="datePicker" placeholder="请选择日期">
                </div>
               
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="gender" value="male" title="男">
                    <input type="radio" name="gender" value="female" title="女">
                    <input type="radio" name="gender" value="random" title="随机" checked>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input type="radio" name="nameType" value="none" title="无">
                    <input type="radio" name="nameType" value="random" title="随机" checked>
                  
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">生成数量</label>
                <div class="layui-input-inline">
                    <input type="text" name="quantity" required lay-verify="required|number" placeholder="请输入数量" autocomplete="off" class="layui-input" value="10">
                </div>
       
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">生成</button>
                  

                </div>
            </div>
        </form>

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;line-height: 25px; font-size: 14px;">
            <legend>生成结果</legend>
        </fieldset>

        <div id="result" style="margin-top: 10px;">
            <!-- 这里放生成的结果 -->
        </div>
    </div>

    <script>
    
    // 定义姓氏列表
const surnames = [
  "王", "李", "张", "刘", "陈", "杨", "赵", "黄", "周", "吴",
  "徐", "孙", "胡", "朱", "高", "林", "何", "郭", "马", "罗"
];

// 定义名字列表(这里只是简单的例子,实际可以更丰富)
const givenNames = [
  "伟", "芳", "娜", "敏", "静", "丽", "强", "磊", "洋", "勇",
  "军", "杰", "娟", "涛", "明", "霞", "秀英", "华", "平", "刚"
];
        layui.use(['form', 'layer'], function(){
            
            var laydate = layui.laydate;

    // 执行一个日期选择器实例
    laydate.render({
        elem: '#datePicker' // 绑定元素
    });
            var form = layui.form;
            var layer = layui.layer;
             var $ = layui.jquery;
              var provinceSelect = $('#province');
            var citySelect = $('#city');
            var districtSelect = $('#district');
            var loadingDiv = $('#loading');
            var errorDiv = $('#error');
    
            let data = [];
            
            // 监听单选按钮选择事件
    form.on('radio(dateType)', function(data){
        
        if(data.value=="specific"){
            $("#datechoose").show();
        }else{
             $("#datechoose").hide();
        }
        //console.log(data.value); // 获取选中的值
       // console.log(data.elem);  // 获取选中元素的DOM对象
        //console.log(data.othis); // 获取选中元素的layui封装的对象
    });
    
            async function fetchCSVData(url) {
                try {
                    const response = await fetch(url);
                    if (!response.ok) {
                        throw new Error(`HTTP error! status: ${response.status}`);
                    }
                    const csvText = await response.text();
                    return csvText.split('\n').slice(1).filter(row => row.trim() !== '').map(row => {
                        const columns = row.split(',');
                        if (columns.length < 8) {
                            console.warn('Row with insufficient columns:', row);
                            return null;
                        }
                        const [id, pid, deep, name, pinyin_prefix, pinyin, ext_id, ext_name] = columns;
                        return {
                            id: parseInt(id) || 0,
                            pid: parseInt(pid) || 0,
                            deep: parseInt(deep) || 0,
                            name: (name || "").replace(/"/g, ''),
                            ext_name: (ext_name || "").replace(/"/g, '')
                       .........完整代码请登录后点击上方下载按钮下载查看

网友评论0