代码之家  ›  专栏  ›  技术社区  ›  w0051977

日期选取器没有格式

  •  0
  • w0051977  · 技术社区  · 6 年前

    请参阅下面的代码,我从这里获取: https://jqueryui.com/datepicker/min max

    文档类型HTML>
    <html lang=“en”>
    &头;
    <link rel=“stylesheet”href=“//code.jquery.com/ui/1.11.4/themes/smitness/jquery ui.css”>
    <meta charset=“utf-8”>
    <meta name=“viewport”content=“width=device width,initial scale=1”>
    <title>jquery UI日期选取器-限制日期范围</title>
    <script src=“https://code.jquery.com/jquery-1.12.4.js”></script>
    <script src=“https://code.jquery.com/ui/1.12.1/jquery ui.js”></script>
    
    脚本& GT;
    $(函数){
    $(datepicker”).datepicker(mindate:-20,maxdate:“+1m+10d”,dateform:“dd/mm/yy”);
    (});
    & /脚本& GT;
    和/头& GT;
    和身体;
    
    <P>日期:<input type=“text”id=“datepicker”readonly=“true”></P>
    
    
    和/身体;
    </html>>=

    在我的所有浏览器(Chrome;FireFox;IE和Edge)中,日期选择器都是这样的:

    我希望它看起来更平滑;也许像这样(在链接中):。

    我花了两个小时的时间在谷歌上搜索,除了以下内容,我什么也没找到: Why my datepicker looks so weired? 但是,这个解决方案对我不起作用。

    <!doctype html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>jQuery UI Datepicker - Restrict date range</title>
      <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
      <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
    
      <script>
      $( function() {
        $( "#datepicker" ).datepicker({ minDate: -20, maxDate: "+1M +10D", dateFormat: "dd/mm/yy" });
      } );
      </script>
    </head>
    <body>
    
    <p>Date: <input type="text" id="datepicker" readonly="true"></p>
    
    
    </body>
    </html>

    在我的所有浏览器(Chrome、Firefox、IE和Edge)中,日期选择器都是这样的:

    enter image description here

    我希望它看起来更平滑;可能像这样(在链接中):

    enter image description here

    我花了两个小时的时间搜索这个,除了这个什么也没发现: WHY my Datepicker looks so weired? . 但是,这个解决方案对我不起作用。

    1 回复  |  直到 6 年前
        1
  •  0
  •   connexo    6 年前

    替换

    <link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
    

    通过

    <link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
    

    你缺少协议了 https: href 价值。如果不从Web服务器提供页面服务,我假设不支持解析无协议URL。

    如果要使用 file:// 协议。