帖子
帖子
用户
博客
课程
12下一页
返回列表 发新帖
显示全部楼层

选择日期和时间

[复制链接]
发表于 2016-3-11 10:49:36
能够同时选择日期和时间的第三方控件第一步,先引用JS和CSS  注:JSS与CSS会上传上来的。
<link rel="stylesheet" href="../css/mobiscroll.custom-2.17.1.min.css" />
<script type="text/javascript" src="../script/jquery-1.11.0.js"></script>
<script type="text/javascript" src="../script/mobiscroll.min.js"></script>

HTML代码(样式我就不写了)
<body>
<table>
                <tr>
                        <td class="td_img"><img src="../image/img/calendar1.png" /></td>
                        <td class="time"><span>开始时间:</span></td>
                        <td>
                        <input id="demob" placeholder="请选择时间" />
                                </td>
                                </tr>
                                <tr>
                                        <td class="td_img"><img src="../image/img/calendar1.png" /></td>
                                        <td><span>结束时间:</span></td>
                                        <td>
                                        <input id="demoe" placeholder="请选择时间" />
                                        </td>
                                </tr>
                        </table>

</body>
JS代码
//选择时间开始时间
                $(function() {
                        var now = new Date();
                        $('#demob').mobiscroll().datetime({
                                theme : 'android-holo-light',
                                lang : 'zh',
                                display : 'bottom',
                                dateOrder : 'yymmdd',
                                //timeFormat: 'HH:ii',
                                showLabel : true,
                                timeWheels : 'HHii',
                                seconds : false,
                                minDate : new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30),
                                maxDate : new Date(now.getFullYear(), now.getMonth(), now.getDate() + 30)
                        });
                });
                //选择时间结束时间
                $(function() {
                        var now = new Date();
                        $('#demoe').mobiscroll().datetime({
                                theme : 'android-holo-light',
                                lang : 'zh',
                                display : 'bottom',
                                dateOrder : 'yymmdd',
                                //timeFormat: 'HH:ii',
                                showLabel : true,
                                timeWheels : 'HHii',
                                seconds : false,
                                minDate : new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30),
                                maxDate : new Date(now.getFullYear(), now.getMonth(), now.getDate() + 30)
                        });
                });


以上就是选择日期时间的代码,效果图如下




附件:




本帖子中包含更多资源,您需要 登录 才可以下载或查看,没有帐号?立即注册

X
第一个帖子,如果有那些不好的请多多指导
11
帖子
0
勋章
192
Y币
这个iOS里能用吗?
搜农 发表于 2016-3-12 06:27
这个iOS里能用吗?

能用的 支持IOS和Android 兼容性都没问题。
203
帖子
3
勋章
3425
Y币
哟,土豪............................
203
帖子
3
勋章
3425
Y币
会玩......................................
1682
帖子
10
勋章
3425
Y币
感谢分享
7
帖子
0
勋章
373
Y币
请问下  可以去掉时分吗?或者想要日期时间并在一排  怎么做呢?
0
帖子
0
勋章
2
Y币
在模拟器里面确定取消按钮没了
0
帖子
0
勋章
2
Y币
感谢,非常好的一个插件
12下一页
您需要登录后才可以回帖 登录

本版积分规则