我需要的是,当按下空白时,只显示六月的日历,或者从2014-06-01到2014-06-07突出显示,或者禁用其余的日期。我见过关于高照明的帖子,也尝试过一些没有成功的东西。如果有人能帮我把这件事准备好,我会很高兴的,提前谢谢你,以下是我所拥有的:
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>
jQuery UI Datepicker - Opciones de localización
</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script src="jquery.ui.datepicker-es.js"></script>
<script>
$(function () {
$("#datepicker").click(function(){
$.datepicker.setDefaults($.datepicker.regional["es"]);
$("#datepicker").datepicker({
dateFormat: 'yy-mm-dd',
firstDay: 1
});
});
});
</script>
</head>
<body>
<input id="datepicker" type="text">
</body>
</html>发布于 2014-05-06 12:41:26
datepicker小部件具有min和max日期属性。
<script>
$(function () {
$("#datepicker").click(function(){
$.datepicker.setDefaults($.datepicker.regional["es"]);
$("#datepicker").datepicker({
dateFormat: 'yy-mm-dd',
firstDay: 1,
minDate: new Date( *enter your start date here* ),
maxDate: new Date( *enter your end date here* )
});
});
});
</script>文档:http://api.jqueryui.com/datepicker/
发布于 2014-05-06 12:58:10
此代码可帮助您只启用特定日期。
var availableDates = ["1-6-2014","2-6-2014","3-6-2014","4-6-2014","5-6-2014","6-6-2014","7-6-2014",];
function available(date)
{
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
if ($.inArray(dmy, availableDates) != -1)
{
return [true, "","Available"];
}
else
{
return [false,"","unAvailable"];
}
}
$('#date').datepicker({ beforeShowDay: available });希望能帮上忙!
https://stackoverflow.com/questions/23494986
复制相似问题