如何使jquery日历不从系统中选择当前日期

时间:2014-03-10 03:09:44

标签: javascript jquery

我的系统上设置了错误的系统日期,Jquery日历正在选择当前日期作为我系统的当前日期..如何使其显示来自Internet的当前日期 .can任何人都可以解决这个问题

1 个答案:

答案 0 :(得分:0)

请尝试此代码,希望它对您有所帮助。感谢

<强> HTML:

<input type="text" id="stDate"/>

<强> JS:

$(function(){
$("#stDate").datepicker({ dateFormat: 'mm/dd/yy', 
                                 changeMonth: true,
                                 changeYear: true,
                                 yearRange: '-70:+10',
                                 constrainInput: false,
                                 duration: '',
                                 gotoCurrent: true}).datepicker('setDate',"0");
});

示例HTML页面

<!DOCTYPE html>
<html>
  <head>
     <title>
    Date Time Now
     </title>
     <meta charset="utf-8" />
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
    <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
    <script type="text/javascript">
    $(function(){
        $("#stDate").datepicker({ dateFormat: 'mm/dd/yy', 
                                 changeMonth: true,
                                 changeYear: true,
                                 yearRange: '-70:+10',
                                 constrainInput: false,
                                 duration: '',
                                 gotoCurrent: true}).datepicker('setDate',"0");
    });
    </script>
    </head>
    <body>
        <input type="text" id="stDate"/>            
    </body>
</html>

Demo

相关问题