这两天使用jquery做一个web端展示的工具,遇到了不少问题也学到了不少知识。其中有一个就是在页面中显示日期选择器的功能,通过百度直接使用的是jquery datepicker 看到一篇使用说明很不错就直接把源码挡过来了,哈哈。给自己mark下加深记忆

 <html>
<head>
<meta charset="utf-8">
<title>演示:日期选择器:jquery datepicker的使用</title>
<meta name="keywords" content="datepicker, jquery插件" />
<meta name="description" content="Helloweba演示平台,演示XHTML、CSS、jquery、PHP案例和示例" />
<link rel="stylesheet" type="text/css" href="../css/main.css" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css" />
<style type="text/css">
.demo{width:500px; margin:20px auto}
.demo h4{height:32px; line-height:32px; font-size:14px}
.demo h4 span{font-weight:500; font-size:12px}
.demo p{line-height:28px;}
input{width:108px; height:20px; line-height:20px; padding:2px; border:1px solid #d3d3d3}
</style>
<script type="text/javascript" src="../js/my.js"></script>
<script type="text/javascript" src="js/jquery-ui-datepicker.js"></script>
<script type="text/javascript">
$(function(){
$("#date_1").datepicker();
$("#date_2").datepicker({
//navigationAsDateFormat: true,
dateFormat: 'yy年mm月dd日'
});
$("#date_3").datepicker({
minDate: -30,
maxDate: 0
});
$("#date_4").datepicker({
altField: "#alternate",
altFormat: "yy年MMd日,DD"
});
$("#datepicker").datepicker({
showOtherMonths: true,
selectOtherMonths: false
});
$("#date_6").datepicker({
showWeek: true
});
$("#date_7").datepicker({
numberOfMonths: 3,
showButtonPanel: true
});
$("#date_8").datepicker({
showOn: "button",
buttonImage: "images/calendar.gif",
buttonImageOnly: true
});
$("#date_9").datepicker({
onSelect: function(dateText,inst){
alert("您选择的日期是:"+dateText)
}
});
});
</script>
</head> <body>
<div id="header">
<div id="logo"><h1><a href="http://www.helloweba.com" title="返回helloweba首页">helloweba</a></h1></div>
<div class="demo_topad"><script src="/js/ad_js/demo_topad.js" type="text/javascript"></script></div>
</div>
<div id="main">
<h2 class="top_title"><a href="http://www.helloweba.com/view-blog-168.html">日期选择器:jquery datepicker的使用</a></h2>
<div class="demo">
<h4>1、默认格式:<span>yy-mm-dd</span></h4>
<p>日期:<input type="text" id="date_1" readonly /></p>
</div>
<div class="demo" id="s2">
<h4>2、格式化日期:<span>yy年mm月dd日</span></h4>
<p>日期:<input type="text" id="date_2" readonly /></p>
</div>
<div class="demo" id="s3">
<h4>3、设置日期可选范围:<span>当前日期前30天</span></h4>
<p>日期:<input type="text" id="date_3" readonly /></p>
</div>
<div class="demo" id="s4">
<h4>4、关联同步不同的日期格式:</h4>
<p>日期:<input type="text" id="date_4" readonly /> &nbsp; <input type="text" id="alternate" style="width:150px" /></p>
</div>
<div class="demo">
<h4>5、直接显示日历:</h4>
<div id="datepicker"></div>
</div>
<div class="demo">
<h4>6、显示日期所在一年中的周数:</h4>
<p>日期:<input type="text" id="date_6" readonly /></p>
</div>
<div class="demo" id="s7">
<h4>7、显示连续的3个月的日历:</h4>
<p>日期:<input type="text" id="date_7" readonly /></p>
</div>
<div class="demo" id="s8">
<h4>8、通过点击图标触发显示日历:</h4>
<p>日期:<input type="text" id="date_8" readonly style="height:16px" /></p>
</div>
<div class="demo" id="s9">
<h4>9、选中日期后触发事件:</h4>
<p>日期:<input type="text" id="date_9" readonly /></p>
</div>
<div class="ad_demo"><script src="/js/ad_js/ad_demo.js" type="text/javascript"></script></div>
<br/>
</div>
<div id="footer">
<p>Powered by helloweba.com 允许转载、修改和使用本站的DEMO,但请注明出处:<a href="http://www.helloweba.com">www.helloweba.com</a></p>
</div>
<p id="stat"><script type="text/javascript" src="/js/tongji.js"></script></p>
</body>
</html>

jQuery-ui datepicker的使用演示代码的更多相关文章

  1. jQuery UI Datepicker使用介绍

    本博客使用Markdown编辑器编写 在企业级web开发过程中,日历控件和图表控件是使用最多的2中第三方组件.jQuery UI带的Datepicker,日历控件能满足大多数场景开发需要.本文就主要讨 ...

  2. jQuery UI Datepicker&Datetimepicker添加 时-分-秒 并且,判断

    jQuery UI Datepicker时间(年-月-日) 相关代码: <input type="text" value="" name="ad ...

  3. JQuery UI datepicker 使用方法(转)

    官方地址:http://docs.jquery.com/UI/Datepicker,官方示例: http://jqueryui.com/demos/datepicker/. 一个不错的地址,用来DIY ...

  4. 页面日期选择控件--jquery ui datepicker 插件

    日期选择插件Datepicker是一个配置灵活的插件,我们可以自定义其展示方式,包括日期格式.语言.限制选择日期范围.添加相关按钮以及其它导航等.官方地址:http://docs.jquery.com ...

  5. jQuery UI datepicker z-index默认为1 怎么处理

    最近在维护一个后台系统的时候遇到这样的一个坑:后台系统中日期控件使用的是jQuery UI datepicker. 这个控件生成的日期选择框的z-index = 1.问题来了.页面上有不少z-inde ...

  6. 坑爹的jquery ui datepicker

    1.坑爹的jquery ui datepicker 竟然不支持选取时分秒,害的我Format半天 期间尝试了bootstrap的ditepicker,但是不起作用,发现被jquery ui 覆盖了, ...

  7. [转]Using the HTML5 and jQuery UI Datepicker Popup Calendar with ASP.NET MVC - Part 4

    本文转自:http://www.asp.net/mvc/overview/older-versions/using-the-html5-and-jquery-ui-datepicker-popup-c ...

  8. 第一好用的时间 日期插件(Adding a Timepicker to jQuery UI Datepicker)

          最近在一个项目中用到了My97DatePicker,国人写的一个挺不错的时间选择插件,简单易用,但是在调试静态时却发现此插件必须产生一个iframe标签指向其主页,试了很多种方法都不能去除 ...

  9. jquery UI datepicker汉化

    由于近期工作需要,jquery ui的datepicker需要汉化,特此把代码贴在这$(function() { $.datepicker.regional["zh-CN"] = ...

  10. JQuery UI Datepicker中文显示的方法

    出自:http://www.aimks.com/method-to-display-the-jquery-ui-datepicker-chinese.html Query UI Datepicker这 ...

随机推荐

  1. hdu 1180诡异的楼梯(bfs)

    诡异的楼梯 Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submis ...

  2. Windows下Apache+Django+mod_wsgi的static和media问题处理

    配置好了Apache可以访问Django工程了(参见前篇:Windows编译安装mod_wsgi,配合使用Django+Apahce) 但是Django中的static.media等文件Apache是 ...

  3. try...catch...finally...return的四角恋

    java里的try...catch...finally的三角恋关系众多程序员必然是不陌生的.但是他们三者再加上一个return的话,就会难倒一大片人吧.以前就对这个知道这个问题,没系统的总结一下,结果 ...

  4. HDU 5741 Helter Skelter

    离线处理+扫描线.题意很容易转化:若干个矩形形成并集,询问一些点是否在并集中? 官方题解不是这样做的....那种做法效率更高,暂时还不会.我这样是4500ms G++过的,C++TLE...... 区 ...

  5. P3414 SAC#1 - 组合数

    题目背景 本题由世界上最蒟蒻最辣鸡最撒比的SOL提供. 寂月城网站是完美信息教室的官网.地址:http://191.101.11.174/mgzd . 题目描述 辣鸡蒟蒻SOL是一个傻逼,他居然觉得数 ...

  6. redis 工具类 单个redis、JedisPool 及多个redis、shardedJedisPool与spring的集成配置

    http://www.cnblogs.com/edisonfeng/p/3571870.html http://javacrazyer.iteye.com/blog/1840161 http://ww ...

  7. ViewPager+Fragment,Fragment会预加载的问题

    http://www.bubuko.com/infodetail-535920.html 在Fragmetn里,onCreateView去加载布局,真正的加载数据通过这个方法setUserVisibl ...

  8. 为什么有时候必须添加sys.setdefaultencoding('utf-8')

    今天在尝试Python的CGI模块时遇到中文字符不能正确显示的问题,很郁闷.在网上仔细找了找,终于解决了这个问题,现在将解决方法陈述如下,以防下次失误. 页面源代码如下 #-*- coding: ut ...

  9. nginx php版本隐藏

    配置完一台服务器后,并不是就可以高枕无忧了,前不久刚刚爆发的PHP 5.3.9版本的漏洞也搞得人心惶惶,所以说经常关注安全公告并及时升级服务器也是必要的.一般来说,黑客攻击服务器的首要步骤就是收集信息 ...

  10. jquery选中checkbox多选项并添加到文本框中

    <script> function check(){ var dd = ""; if($("input[type='checkbox'][name='moke ...