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

标签 javascript jquery

我的系统上设置了错误的系统日期,Jquery Calendar 正在选择当前日期作为我系统的当前日期..如何使其显示来自 Internet 的当前日期 .谁能解决这个问题

最佳答案

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

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

关于javascript - 如何使jquery日历不从系统中选择当前日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22291433/

相关文章:

javascript - 如何解决 Mongoose Connect UNKNOWN 问题?

javascript - "onfocus"事件不适用于动态附加的输入

javascript - 使用 jQuery 确定视频文件大小

javascript - 将 HTML 数据导入 JavaScript

javascript - 这个小鸟动画是怎么画的?

javascript - 最简单的递归函数返回 undefined

javascript - 当我在页面加载时创建容器/父 Div .fadeIn 时,jQuery(和所有#links)中断 - 为什么?

javascript - chrome 中点击是否也会触发鼠标移出

javascript - jQuery.support.cors 的替代品

javascript - delay() 函数不适用于 jquery 中的 addClass() 函数