在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ HTML/ jQuery UI Datepicker 示例(三)
jQuery UI Tab 示例(一)
jQuery UI Datepicker 示例(四)
jQuery UI 示例
jQuery UI Slider 示例(二)
jQuery UI Dialog 示例(一)
HTML Get
動(dòng)畫效果
終止動(dòng)畫
回調(diào)函數(shù)
方法鏈
jQuery UI Button 示例(一)
jQuery UI Autocomplete 示例(三)
jQuery UI Autocomplete 示例(二)
設(shè)置或取得元素的 CSS class
jQuery UI 概述
基本語法
jQuery UI Datepicker 示例(一)
jQuery UI Autocomplete 示例(一)
jQuery UI Spiner 示例
jQuery UI Tab 示例(二)
淡入淡出效果
顯示/隱藏內(nèi)容
HTML Set
jQuery UI Tooltip 示例
jQuery UI Slider 示例(一)
讀寫 HTML 元素的 css 屬性
jQuery UI Datepicker 示例(二)
添加HTML元素
操作 HTML 元素的大小
jQuery UI Datepicker 示例(五)
滑動(dòng)效果
jQuery UI Dialog 示例(二)
jQuery UI Menu 示例
jQuery UI 基本工作過程
jQuery UI Button 示例(二)
jQuery UI Dialog 示例(三)
jQuery UI Datepicker 示例(三)
Selectors
jQuery UI Progressbar 示例
Events
jQuery UI Accordion 示例
刪除HTML元素

jQuery UI Datepicker 示例(三)

格式化日期

可以通過日期格式重新定義 Datepicker 顯示日期時(shí)的格式。

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>jQuery UI Demos</title>
    <link rel="stylesheet" href="themes/trontastic/jquery-ui.css" />
    <script src="scripts/jquery-1.9.1.js"></script>
    <script src="scripts/jquery-ui-1.10.1.custom.js"></script>
    <script>
        $(function () {
            $("#datepicker").datepicker();
            $("#format").change(function () {
                $("#datepicker").datepicker("option",
                    "dateFormat", $(this).val());
            });
        });
    </script>
</head>
<body>

    <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, y</option>
            <option value="d MM, y">Medium - d MM, y</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>
</body>
</html>

http://wiki.jikexueyuan.com/project/jquery-tutorial/images/36.png" alt="" />

本地化支持

Datepicker 預(yù)設(shè)使用英語顯示,可以通過配置修改顯示語言。

如果需要支持不同語言,可以添加,如:

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>jQuery UI Demos</title>
    <link rel="stylesheet" href="themes/trontastic/jquery-ui.css" />
    <script src="scripts/jquery-1.9.1.js"></script>
    <script src="scripts/jquery-ui-1.10.1.custom.js"></script>
    <script src="scripts/jquery.ui.datepicker-ar.js"></script>
    <script src="scripts/jquery.ui.datepicker-fr.js"></script>
    <script src="scripts/jquery.ui.datepicker-he.js"></script>
    <script src="scripts/jquery.ui.datepicker-zh-TW.js"></script>

    <script>
        $(function () {
            $.datepicker.setDefaults($.datepicker.regional[""]);
            $("#datepicker").datepicker($.datepicker.regional["fr"]);
            $("#locale").change(function () {
                $("#datepicker").datepicker("option",
                  $.datepicker.regional[$(this).val()]);
            });
        });
    </script>
</head>
<body>
    <p>
        Date:
        <input type="text" id="datepicker" />&nbsp;
  <select id="locale">
      <option value="ar">Arabic (?(?????</option>
      <option value="zh-TW">Chinese Traditional (繁體中文)</option>
      <option value="fr" selected="selected">French (Fran?ais)</option>
      <option value="he">Hebrew (?(?????</option>
  </select>
    </p>
</body>
</html>

http://wiki.jikexueyuan.com/project/jquery-tutorial/images/37.png" alt="" />

如果需要添加自定義的語言,比如簡(jiǎn)體中文,可以打開 jquery.ui.datepicker-zh-TW.js 看看,

/* Chinese initialisation for the jQuery UI date picker plugin. */
/* Written by Ressol (ressol@gmail.com). */
jQuery(function($){
    $.datepicker.regional['zh-TW'] = {
        closeText: '關(guān)閉',
        prevText: '&#x3C;上月',
        nextText: '下月&#x3E;',
        currentText: '今天',
        monthNames: ['一月','二月','三月','四月','五月','六月',
        '七月','八月','九月','十月','十一月','十二月'],
        monthNamesShort: ['一月','二月','三月','四月','五月','六月',
        '七月','八月','九月','十月','十一月','十二月'],
        dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
        dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
        dayNamesMin: ['日','一','二','三','四','五','六'],
        weekHeader: '周',
        dateFormat: 'yy/mm/dd',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: true,
        yearSuffix: '年'};
    $.datepicker.setDefaults($.datepicker.regional['zh-TW']);
});

只要把 zh-TW 改成 zh-CN ,把其中的繁體「關(guān)閉」改成「關(guān)閉」 保存為 jquery.ui.datepicker-zh-CN.js,然後使用 zh-CN 作為區(qū)域選項(xiàng)即可。