现在市面上的日期控件有很多,程序员可以随意拿来使用,我最常用的还是jquery 的datepicker,在这里做一个记号,方便对日期控件无从下手的朋友参考,
首先,试用jquery的日期控件需要引用到一些jquery的样式和脚本文件,这些文件本文结尾提供下载
<
link type
=
"
text/css
"
href
=
"
Models/jquery-ui-1.7.2/themes/base/ui.all.css
"
rel
=
"
stylesheet
"
media = " screen " / >
< script src = " Models/jquery-1.3.2.js " type = " text/javascript " >< / script>
< script src = " Models/jquery-ui-1.7.2/ui/ui.core.js " type = " text/javascript " >< / script>
< script src = " Models/jquery-ui-1.7.2/ui/ui.datepicker.js " type = " text/javascript " >< / script>
< script src = " Models/jquery-ui-1.7.2/ui/i18n/ui.datepicker-zh-CN.js " type = " text/javascript " >< / script>
< script type = " text/javascript " >
$( function () {
$.datepicker.setDefaults($.extend({}, $.datepicker.regional[ ' zh-CN ' ]));
$( " .datepicker " ).datepicker({
changeMonth: true ,
changeYear: true
});
});
< / script>
media = " screen " / >
< script src = " Models/jquery-1.3.2.js " type = " text/javascript " >< / script>
< script src = " Models/jquery-ui-1.7.2/ui/ui.core.js " type = " text/javascript " >< / script>
< script src = " Models/jquery-ui-1.7.2/ui/ui.datepicker.js " type = " text/javascript " >< / script>
< script src = " Models/jquery-ui-1.7.2/ui/i18n/ui.datepicker-zh-CN.js " type = " text/javascript " >< / script>
< script type = " text/javascript " >
$( function () {
$.datepicker.setDefaults($.extend({}, $.datepicker.regional[ ' zh-CN ' ]));
$( " .datepicker " ).datepicker({
changeMonth: true ,
changeYear: true
});
});
< / script>
那么页面上怎么使用呢?
其实很简单,只需要在需要用到日期空间的地方加一个样式引用就可以了
<asp:TextBox ID="SampDate" CssClass="datepicker" runat="server"></asp:TextBox>