jQuery UI Datepicker日期选择插件很好用了,只不过只能精确到日,不能选择时间(小时分钟秒)很遗憾,而jquery-ui-timepicker-addon.js正是基于jQuery UI Datepicker的一款可选时间的插件。

官网地址:http://trentrichardson.com/examples/timepicker/

官网demo下载:https://github.com/trentrichardson/jQuery-Timepicker-Addon

效果图

DEMO

 

<!doctype html>
<html lang="us">
<head>
    <meta charset="utf-8">
    <title>jQuery UI Example Page</title>
    <link href="jquery-ui.css" rel="stylesheet">

</head>
<body>
<!-- Datepicker -->
<h2 class="demoHeaders">Datepicker</h2>
<div id="datepicker"></div>

<input type="text" id="datetime" name="datetime" value="" />

<script src="external/jquery/jquery.js"></script>
<script src="jquery-ui.js"></script>
<script src="jquery-ui-timepicker-addon.js"></script>

<script>

$("#datetime").datetimepicker(); // 日期+时分秒
$("#datetime").datepicker('option', {dateFormat: 'yy/mm/dd'}); // 日期
$("#datetime").timepicker(); // 时分秒


$( "#datepicker" ).datepicker({
    inline: true
});

</script>
</body>
</html>

 

参考来源:http://blog.csdn.net/sunbiao0526/article/details/8176794

http://www.cnblogs.com/stone_w/archive/2012/11/22/2783044.html

 

posted on 2015-03-09 18:31  keitho00  阅读(464)  评论(0编辑  收藏  举报