Home > Web Front-end > JS Tutorial > body text

JS 替换和时间插件的结合使用方法_javascript技巧

WBOY
Release: 2016-05-16 17:29:40
Original
1241 people have browsed it


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

复制代码 代码如下:

// 日期
    $('.date').datepicker({
        changeYear: true,
        changeMonth: true,
        minDate:null,
        maxDate:null,
        onClose: function(selectedDate) {
            $('.gap-date').datepicker('option','minDate', '+1m');
        }
    });

    // 日期范围
    $('.gap-date').datepicker({
        changeYear: true,
        changeMonth: true,
        maxDate:null,
        onClose: function(selectedDate) {
            var y, m, d;
            var arr = selectedDate.split('-');
            y = arr[0];
            m = arr[1] - 7;
            d = arr[2];
            $('.date').datepicker('option','maxDate', new Date(y, m, d));
        }
    });
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!