日期选择器的多个实例

时间:2011-04-15 06:59:30

标签: jquery jquery-ui datepicker

我如何能够使用多个日期选择器实例?一个日期选择器正在工作,但是日期选择器的下一个实例正在调用相同的弹出窗口,如何继续? 任何人都可以给我你的电子邮件ID ...我会把整个代码邮寄给你...然后你就能以更好的方式获得整个想法

http://jsfiddle.net/premseoul/BjDYP/

Zip中的链接提供了整套代码..请下载zip ... http://www.4shared.com/file/ZQy2A3DU/DateTime.html

3 个答案:

答案 0 :(得分:4)

http://jsfiddle.net/d4Aqz/

$( "#datepicker" ).datepicker();
$( "#datepicker2" ).datepicker();

答案 1 :(得分:1)

window.onload = function(){
    new JsDatePick({
        useMode:2,
        target:"inputField1",
        dateFormat:"%Y-%m-%d"
        /*selectedDate:{                This is an example of what the full configuration offers.
            day:5,                      For full documentation about these settings please see the full version of the code.
            month:9,
            year:2006
        },
        yearsRange:[1978,2020],
        limitToToday:false,
        cellColorScheme:"beige",
        dateFormat:"%Y-%M-%d",
        imgPath:"img/",
        weekStartDay:1*/
    });
};

但函数以这种方式调用

答案 2 :(得分:0)

我不知道你的意思。但是,如果您有多个日期选择器,则必须使用class

<script>
        $(function() {
                        $(".datepicker").datepicker({ dateFormat:'yy-mm-dd'});
                        });
</script>


<table cellpadding="0" cellspacing="0">
                                <tr>
                                        <td  width="300">Problem Date</td>
                                        <td width="10">:</td>
                                        <td width="150" align="left">
                                                <input type="text" id="datepicker" name="prob_date" class="datepicker">
                                        </td>
                                </tr>

                                 <tr>
                                        <td  width="300">Eff. Date</td>
                                        <td width="10">:</td>
                                        <td width="150" align="left">
                                                <input type="text" id="datepick" name="eff_date" class="datepicker">
                                        </td>
                                </tr>
</table>
相关问题