JavaScript DHTML/jQuery/UI Datepicker

Материал из Web эксперт
Версия от 07:24, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Add image to date picker trigger button

 
<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
        var pickerOpts = {
          showOn: "button",
          buttonImage: "cal.png",
          buttonImageOnly: true
        };
        
        $("#date").datepicker(pickerOpts);  
    });
  </script>
</head>
<body>
<div class="row"><label>Enter a date: </label><input id="date"></div>
</body>
</html>



Create a date picker

 
<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
            $("#date").datepicker();
    });
  </script>
</head>
<body>
<label>Enter a date: </label><input id="date">
</body>
</html>



dateFormat:"d MM yy"

 
<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
        var pickerOpts = {
          dateFormat:"d MM yy"
        };
      
        $("#date").datepicker(pickerOpts);
    });
  </script>
</head>
<body>
<label>Enter a date: </label><input id="date">
</body>
</html>



Display a dialog to hold the date picker

 
<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
      $("#invoke").click(function() {  
          $("#date").datepicker("dialog", "", updateDate);      
          function updateDate(date) {
            $("#date").val(date);
          }
        });    
    });
  </script>
</head>
<body>
<div id="row"><label>Enter a date: </label>
<input id="date"><a id="invoke" title="" href="#">Click to open Date Picker Dialog</a></div>
</body>
</html>



Display two months

 
<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
        var pickerOpts = {
          numberOfMonths: 2,
          stepMonths: 2,
          changeMonth: false,
          changeYear: false
        };
        
        $("#date").datepicker(pickerOpts);  
    });
  </script>
</head>
<body>
<div class="row"><label>Enter a date: </label><input id="date"></div>
</body>
</html>



firstDay: 1

 


<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
    <script type="text/javascript">
$(document).ready(
  function() {
    $("input#tmpDate").datepicker({
         firstDay: 1
    });
  }
);
    </script>
  </head>
  <body>
        <div>
          <label for="tmpDate">Date:</label>
          <input type="text" id="tmpDate" size="25" value="" />
        </div>        
  </body>
</html>



Internationalize date picker

 

<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
        var frenchOpts = {
          clearText: "vide",
          closeText: "Fin",
          currentText: "Courant",
          dayNamesMin: [ "Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa" ],
          firstDay: 1,
          monthNames: [ "Janvier", "F&eacute;vrier", "Marche", "Avril", "Pouvez", "Juin", "Juillet", "Ao&ucirc;t", "Septembre", "Octobre", "Novembre", "D&eacute;cembre" ],
          nextText: "Apr&egrave;s",
          prevText: "Pr&eacute;c"
        };
        
        $("#date").datepicker(frenchOpts);  
    });
  </script>
</head>
<body>
<label>Enter a date: </label><input id="date">
</body>
</html>



jQuery UI Datepicker - Display button bar

  
<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
  http://docs.jquery.ru/UI/Effects/Blind
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Display button bar</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $("#datepicker").datepicker({
      showButtonPanel: true
    });
  });
  </script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker"></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Display a button for selecting Today"s date and a Done button for closing the calendar with the boolean <code>showButtonPanel</code> option.  Each button is enabled by default when the bar is displayed, but can be turned off with additional options.  Button text is customizable.</p>
</div><!-- End demo-description -->
</body>
</html>



jQuery UI Datepicker - Display inline

  

<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
  http://docs.jquery.ru/UI/Effects/Blind
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Display inline</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $("#datepicker").datepicker();
  });
  </script>
</head>
<body>
<div class="demo">
Date: <div id="datepicker"></div>
</div><!-- End demo -->
<div class="demo-description">
<p>Display the datepicker embedded in the page instead of in an overlay.  Simply call .datepicker() on a div instead of an input.</p>
</div><!-- End demo-description -->
</body>
</html>



jQuery UI Datepicker - Display month and year menus

  
<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
  http://docs.jquery.ru/UI/Effects/Blind
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Display month &amp; year menus</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $("#datepicker").datepicker({
      changeMonth: true,
      changeYear: true
    });
  });
  </script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker"></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Show month and year dropdowns in place of the static month/year header to facilitate navigation through large timeframes.  Add the boolean <code>changeMonth</code> and <code>changeYear</code> options.</p>
</div><!-- End demo-description -->
</body>
</html>



jQuery UI Datepicker - Display multiple months

  
<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Display multiple months</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $("#datepicker").datepicker({
      numberOfMonths: 3,
      showButtonPanel: true
    });
  });
  </script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker"></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Set the <code>numberOfMonths</code> option to an integer of 2 or more to show multiple months in a single datepicker.</p>
</div><!-- End demo-description -->
</body>
</html>



jQuery UI Datepicker - Format date

  
<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
  http://docs.jquery.ru/UI/Effects/Blind
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Format date</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $("#datepicker").datepicker();
    $("#format").change(function() { $("#datepicker").datepicker("option", {dateFormat: $(this).val()}); });
  });
  </script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker" size="30"/></p>
<p>Format options:<br />
  <select id="format">
    <option value="mm/dd/yy">Default - mm/dd/yy</option>
    <option value="yy-mm-dd">ISO 8601 - yy-mm-dd</option>
    <option value="d M, y">Short - d M, yy</option>
    <option value="d MM, y">Medium - d MM, yy</option>
    <option value="DD, d MM, yy">Full - DD, d MM, yy</option>
    <option value=""day" d "of" MM "in the year" yy">With text - "day" d "of" MM "in the year" yy</option>
  </select>
</p>
</div><!-- End demo -->
<div class="demo-description">
<p>Display date feedback in a variety of ways.  Choose a date format from the dropdown, then click on the input and select a date to see it in that format.</p>
</div><!-- End demo-description -->
</body>
</html>



jQuery UI Datepicker - Icon trigger

  
<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
  http://docs.jquery.ru/UI/Effects/Blind
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Icon trigger</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $("#datepicker").datepicker({showOn: "button", buttonImage: "images/calendar.gif", buttonImageOnly: true});
  });
  </script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker"></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Click the icon next to the input field to show the datepicker.  Set the datepicker to open on focus (default behavior), on icon click, or both.</p>
</div><!-- End demo-description -->
</body>
</html>



jQuery UI Datepicker - Localize calendar

  
<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
  http://docs.jquery.ru/UI/Effects/Blind
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Localize calendar</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-ar.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-bg.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-ca.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-cs.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-da.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-de.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-el.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-eo.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-es.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-fa.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-fi.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-fr.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-he.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-hr.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-hu.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-hy.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-id.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-is.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-it.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-ja.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-ko.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-lt.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-lv.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-ms.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-nl.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-no.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-pl.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-pt-BR.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-ro.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-ru.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-sk.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-sl.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-sq.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-sr.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-sr-SR.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-sv.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-th.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-tr.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-uk.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-zh-CN.js"></script>
  <script type="text/javascript" src="js/ui/i18n/ui.datepicker-zh-TW.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $.datepicker.setDefaults($.extend({showMonthAfterYear: false}, $.datepicker.regional[""]));
    $("#datepicker").datepicker($.datepicker.regional["fr"]);
    $("#locale").change(function() {
      $("#datepicker").datepicker("option", $.extend({showMonthAfterYear: false},
        $.datepicker.regional[$(this).val()]));
    });
  });
  </script>
</head>
<body>
<div class="demo">
  
<p>Date: <input type="text" id="datepicker"/>&nbsp;
  <select id="locale">
    <option value="sq">Albanian (Gjuha shqipe)</option>
    <option value="ar">Arabic (&#8235;(&#1604;&#1593;&#1585;&#1576;&#1610;</option>
    <option value="hy">Armenian (&#1344;&#1377;&#1397;&#1381;&#1408;&#1381;&#1398;)</option>
    <option value="bg">Bulgarian (&#1073;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080; &#1077;&#1079;&#1080;&#1082;)</option>
    <option value="ca">Catalan (Catal&agrave;)</option>
    <option value="zh-CN">Chinese Simplified (&#31616;&#20307;&#20013;&#25991;)</option>
    <option value="zh-TW">Chinese Traditional (&#32321;&#39636;&#20013;&#25991;)</option>
    <option value="hr">Croatian (Hrvatski jezik)</option>
    <option value="cs">Czech (Ce&ouml;tina)</option>
    <option value="da">Danish (Dansk)</option>
    <option value="nl">Dutch (Nederlands)</option>
    <option value="eo">Esperanto</option>
    <option value="fa">Farsi/Persian (&#8235;(&#1601;&#1575;&#1585;&#1587;&#1740;</option>
    <option value="fi">Finnish (suomi)</option>
    <option value="fr" selected="selected">French (Fran&ccedil;ais)</option>
    <option value="de">German (Deutsch)</option>
    <option value="el">Greek (&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940;)</option>
    <option value="he">Hebrew (&#8235;(&#1506;&#1489;&#1512;&#1497;&#1514;</option>
    <option value="hu">Hungarian (Magyar)</option>
    <option value="is">Icelandic (&Otilde;slenska)</option>
    <option value="id">Indonesian (Bahasa Indonesia)</option>
    <option value="it">Italian (Italiano)</option>
    <option value="ja">Japanese (&#26085;&#26412;&#35486;)</option>
    <option value="ko">Korean (&#54620;&#44397;&#50612;)</option>
    <option value="lv">Latvian (Latvie&ouml;u Valoda)</option>
    <option value="lt">Lithuanian (lietuviu kalba)</option>
    <option value="ms">Malaysian (Bahasa Malaysia)</option>
    <option value="no">Norwegian (Norsk)</option>
    <option value="pl">Polish (Polski)</option>
    <option value="pt-BR">Portuguese/Brazilian (Portugu&ecirc;s)</option>
    <option value="ro">Romanian (Rom&acirc;n&#259;)</option>
    <option value="ru">Russian (&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;)</option>
    <option value="sr">Serbian (&#1089;&#1088;&#1087;&#1089;&#1082;&#1080; &#1112;&#1077;&#1079;&#1080;&#1082;)</option>
    <option value="sr-SR">Serbian (srpski jezik)</option>
    <option value="sk">Slovak (Slovencina)</option>
    <option value="sl">Slovenian (Slovenski Jezik)</option>
    <option value="es">Spanish (Espa&ntilde;ol)</option>
    <option value="sv">Swedish (Svenska)</option>
    <option value="th">Thai (&#3616;&#3634;&#3625;&#3634;&#3652;&#3607;&#3618;)</option>
    <option value="tr">Turkish (T&uuml;rk&ccedil;e)</option>
    <option value="uk">Ukranian (&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;)</option>
  </select></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Localize the datepicker calendar language and format (English / Western formatting is the default).  The datepicker includes built-in support for languages that read right-to-left, such as Arabic and Hebrew.</p>
</div><!-- End demo-description -->
</body>
</html>



jQuery UI Datepicker - Populate alternate field

  
<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
  http://docs.jquery.ru/UI/Effects/Blind
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Populate alternate field</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $("#datepicker").datepicker({altField: "#alternate", altFormat: "DD, d MM, yy"});
  });
  </script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker">&nbsp;<input type="text" id="alternate" size="30"/></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Populate an alternate field with its own date format whenever a date is selected using the <code>altField</code> and <code>altFormat</code> options.  This feature could be used to present a human-friendly date for user selection, while passing a more computer-friendly date through for further processing.</p>
</div><!-- End demo-description -->
</body>
</html>



jQuery UI Datepicker - Restrict date range

  
<!--
  jQuery UI Effects Blind 1.7.2
 
  Copyright (c) 2009 AUTHORS.txt (http://jqueryui.ru/about)
  Dual licensed under the MIT (MIT-LICENSE.txt)
  and GPL (GPL-LICENSE.txt) licenses.
 
 
-->
<!doctype html>
<html lang="en">
<head>
  <title>jQuery UI Datepicker - Restrict date range</title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
  $(function() {
    $("#datepicker").datepicker({minDate: -20, maxDate: "+1M +10D"});
  });
  </script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker"></p>
</div><!-- End demo -->
<div class="demo-description">
<p>Restrict the range of selectable dates with the <code>minDate</code> and <code>maxDate</code> options.  Set the beginning and end dates as actual dates (new Date(2009, 1 - 1, 26)), as a numeric offset from today (-20), or as a string of periods and units ("+1M +10D").  For the last, use "D" for days, "W" for weeks, "M" for months, or "Y" for years.</p>
</div><!-- End demo-description -->
</body>
</html>



Set date format (appendText: " MM/DD/YYYY")

 
<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
        var pickerOpts = {
          appendText: " MM/DD/YYYY",
          changeFirstDay: false,
          changeMonth: false,
          changeYear: false,
          closeAtTop: false,
          showOtherMonths: true,
          showStatus: true,
          showWeeks: true,
          duration: "fast"
        };
        $("#date").datepicker(pickerOpts);
    });
  </script>
</head>
<body>
<label>Enter a date: </label><input id="date">
</body>
</html>



Set style for date picker

 

<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
    <script type="text/javascript">
$(document).ready(
  function() {
    $("input#tmpDate").datepicker({
      minDate: new Date(2008, 0, 1),
      maxDate: new Date(2009, 0, 1)
    });
  }
);
    </script>
    <style type="text/css">
#ui-datepicker-div {
    width: 300px;
    border: 1px solid rgb(128, 128, 128);
    padding: 5px;
    background: gray;
    display: none;
}
div.ui-datepicker-control {
    position: relative;
    height: 25px;
    background: forestgreen;
}
div.ui-datepicker-control div {
    padding: 5px;
}
div.ui-datepicker-control div a {
    color: #fff;
}
div.ui-datepicker-links {
    position: relative;
    height: 20px;
    padding: 5px 0 0 0;
    background: darkgreen;
    border-bottom: 1px solid green;
    text-align: center;
}
div.ui-datepicker-links div {
    padding: 5px;
}
div.ui-datepicker-links div a {
    color: #fff;    
}
div.ui-datepicker-clear,
div.ui-datepicker-prev {
    position: absolute;
    top: 0;
    left: 0;
}
div.ui-datepicker-close,
div.ui-datepicker-next {
    position: absolute;
    top: 0;
    right: 0;
}
div.ui-datepicker-current {
    display: inline;
}
div.ui-datepicker-header {
    margin-top: 5px;
    text-align: center;
}
div.ui-datepicker-header select {
    margin: 0 3px;    
}
table.ui-datepicker {
    width: 250px;
    border-collapse: collapse;
    margin: 10px 0 0 0;
}
table.ui-datepicker td {
    padding: 3px;
    border: 1px solid red;
}
table.ui-datepicker thead td {
    text-align: center;
    font-weight: bold;
    background: green;
    color: lightgreen;
}
td.ui-datepicker-today {
    background: #dff6e4;
}
td.ui-datepicker-current-day {
    background: darkgreen;
    color: #fff;
}
    </style>
  </head>
  <body>
        <div>
          <label for="tmpDate">Date:</label>
          <input type="text" id="tmpDate" size="25" value="" />
        </div>        
  </body>
</html>



Use button to trigger date picker

 
<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.datepicker.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
        var pickerOpts = {
          showOn: "button"  
        };
        
        //create the date picker
        $("#date").datepicker(pickerOpts);  
    });
  </script>
</head>
<body>
<div class="row"><label>Enter a date: </label><input id="date"></div>
</body>
</html>