jQuery-ui datepicker的使用演示代码
这两天使用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 /> <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的使用演示代码的更多相关文章
- jQuery UI Datepicker使用介绍
本博客使用Markdown编辑器编写 在企业级web开发过程中,日历控件和图表控件是使用最多的2中第三方组件.jQuery UI带的Datepicker,日历控件能满足大多数场景开发需要.本文就主要讨 ...
- jQuery UI Datepicker&Datetimepicker添加 时-分-秒 并且,判断
jQuery UI Datepicker时间(年-月-日) 相关代码: <input type="text" value="" name="ad ...
- JQuery UI datepicker 使用方法(转)
官方地址:http://docs.jquery.com/UI/Datepicker,官方示例: http://jqueryui.com/demos/datepicker/. 一个不错的地址,用来DIY ...
- 页面日期选择控件--jquery ui datepicker 插件
日期选择插件Datepicker是一个配置灵活的插件,我们可以自定义其展示方式,包括日期格式.语言.限制选择日期范围.添加相关按钮以及其它导航等.官方地址:http://docs.jquery.com ...
- jQuery UI datepicker z-index默认为1 怎么处理
最近在维护一个后台系统的时候遇到这样的一个坑:后台系统中日期控件使用的是jQuery UI datepicker. 这个控件生成的日期选择框的z-index = 1.问题来了.页面上有不少z-inde ...
- 坑爹的jquery ui datepicker
1.坑爹的jquery ui datepicker 竟然不支持选取时分秒,害的我Format半天 期间尝试了bootstrap的ditepicker,但是不起作用,发现被jquery ui 覆盖了, ...
- [转]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 ...
- 第一好用的时间 日期插件(Adding a Timepicker to jQuery UI Datepicker)
最近在一个项目中用到了My97DatePicker,国人写的一个挺不错的时间选择插件,简单易用,但是在调试静态时却发现此插件必须产生一个iframe标签指向其主页,试了很多种方法都不能去除 ...
- jquery UI datepicker汉化
由于近期工作需要,jquery ui的datepicker需要汉化,特此把代码贴在这$(function() { $.datepicker.regional["zh-CN"] = ...
- JQuery UI Datepicker中文显示的方法
出自:http://www.aimks.com/method-to-display-the-jquery-ui-datepicker-chinese.html Query UI Datepicker这 ...
随机推荐
- linux进程、管道和重定向
1.shell先后使用fork和exec系统调用来执行一个外部命令. 2.在linux系统中,有三个文件会被内核自动打开,分别是stdin.stdout.stderr. 3.进程的属性相关命令: 查看 ...
- AngularJS 基础用法
判断语句: <li ng-repeat=”person in persons”> <span ng-switch on=”person.sex”> <span ng-sw ...
- Bootstrap学习 - 组件
下拉菜单 注意:需要先引入jQuery.js再引入bootstrap.js(依赖前者) <div class="dropdown pull-right"> //默认就是 ...
- create a new table for the query results
http://stackoverflow.com/questions/2698401/how-to-store-mysql-query-results-in-another-table CREATE ...
- Java与C#的比较学习
http://www.cnblogs.com/javathread/archive/2012/08/11/2634893.html 我在大学学的是C语言,自学和选修的是C++,刚毕业也搞过几天Jsp, ...
- Mysql程序
drop table if exists comp_ap; create table comp_ap as select ProjectName, ModelCode, 'AP_ACMClosed' ...
- Servlet程序开发-- servlet跳转
跳转:服务器端,客户端 客户端跳转:<response.sendRedirect>地址栏跳转之后改变,无法传递request范围的属性 服务器端跳转:<jsp:forward> ...
- C#入门经典第四章-流程控制-1
布尔类型:
- 关于tomcat配置MyEclipse项目的配置代码
例如:<Context path="/shis" docBase="E:\Genuitec\Workspaces\MyEclipse 8.6\zwfw_platfo ...
- openwrt系统之字符设备驱动软件包加载、测试程序加载
.首先将软件包(如mydrv)放到ubuntu虚拟机openwrt/trunk/package/kernel/目录下 .回到openwrt/trunk/目录下,make menuconfig进行配置, ...