js 利用boostrap实现datatimepicker控件

<body>
    <div class="container" >
        <form class="form-horizontal" style="margin-top: 20px;">
            <div class="row clearfix">
                <div class="col-xs-6">
                <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">姓名</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="inputEmail3" placeholder="姓名">
                </div>
                </div>
                </div>
                <div class="col-xs-6">
                <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">年龄</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="inputPassword3" placeholder="年龄">
                </div>
                </div>
                </div>
        </div>

        <div class="row clearfix">
            <div class="col-xs-6">
            <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">薪资</label>
                <div class="col-sm-10">
                  <input type="text" class="form-control" id="inputPassword3" placeholder="薪资">
                </div>
              </div>
            </div>
            <div class="col-xs-6">
              <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">部门</label>
                <div class="col-sm-10">
                  <select class="form-control">
                    <option>IT部门</option>
                    <option>运营部门</option>
                    <option>销售部</option>
                  </select>
                </div>
              </div>
            </div>
        </div> 

        <div class="row clearfix">
            <div class="col-xs-6">
            <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">入职日期</label>
                <div class="col-sm-10">
                  <input type="text" class="form-control" id="dt" placeholder="入职日期">
                </div>
            </div>
            </div>
        </div>
        
        <div class="row clearfix">
            <div class="col-xs-6">
            <div class="form-group">
              <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">提交</button>
              </div>
            </div>
            </div>
        </div>
          </form>
    </div>


    <script src="./static/jquery-3.6.3.min.js"></script>
    <script src="./static/plugins/bootstrap-3.4.1-dist/js/bootstrap.js"></script>
    <script src="./static/bootstrap-datepicker-1.9.0/js/bootstrap-datepicker.min.js"></script>
    <script src="./static/bootstrap-datepicker-1.9.0/locales/bootstrap-datepicker.zh-CN.min.js"></script>
    <script>
        $(
            $('#dt').datepicker({
                
                format: 'yyyy-mm-dd',			//显示年月日
                language:'zh-CN',
                startDate: "2020-06-10", //开始时间,在这时间之前都不可选
                autoclass:true,
                autoclose: true, //选择后自动关闭
                clearBtn: true,//清除按钮
                
            })
        );
    </script>

</body>

利用boostrap实现的时间表格控件,这里仅做一下记录。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
你可以使用 HTML 和 JavaScript 来创建表格控件。在 HTML 中,你可以使用 `<table>` 元素来定义表格的结构,`<tr>` 元素来定义表格的行,`<td>` 元素来定义表格的单元格。通过 JavaScript,你可以动态地添加、修改和删除表格的内容。 下面是一个示例,展示了如何使用 HTML 和 JavaScript 创建一个简单的表格控件: ```html <!DOCTYPE html> <html> <head> <title>表格控件示例</title> <style> table { border-collapse: collapse; width: 100%; } th, td { border: 1px solid black; padding: 8px; text-align: left; } </style> </head> <body> <button onclick="addRow()">添加行</button> <button onclick="deleteRow()">删除行</button> <table id="myTable"> <tr> <th>姓名</th> <th>年龄</th> </tr> <tr> <td>张三</td> <td>25</td> </tr> <tr> <td>李四</td> <td>30</td> </tr> </table> <script> function addRow() { var table = document.getElementById("myTable"); var row = table.insertRow(table.rows.length); var cell1 = row.insertCell(0); var cell2 = row.insertCell(1); cell1.innerHTML = "新行"; cell2.innerHTML = "新行"; } function deleteRow() { var table = document.getElementById("myTable"); if (table.rows.length > 2) { table.deleteRow(table.rows.length - 1); } } </script> </body> </html> ``` 在上面的示例中,点击 "添加行" 按钮会在表格末尾添加一行,点击 "删除行" 按钮会删除表格的最后一行。你可以根据需要进一步扩展此示例,实现更多功能和交互效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

秋冬晚归客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值