我一生都无法弄清楚为什么这段代码不起作用。我确定我在做一些非常愚蠢的事情,但我就是找不到!我目前只是试图禁用所有日期栏“7-8-2013”。对此的任何帮助将不胜感激。谢谢!
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Calender Control Test</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
var enableDays = ["7-8-2013"];
$(function enableAllTheseDays(date) {
var m = date.getMonth(), var d = date.getDate(), var y = date.getFullYear();
for (i = 0; i < enableDays.length; i++) {
if($.inArray((d+1) + '-' + m + '-' + y,enableDays) != -1) {
return [true];
}
}
return [false];
$('#datepicker').datepicker({dateFormat: 'dd-mm-yy', beforeShowDay: enableAllTheseDays});
</script>
</head>
<body>
<div id="datepicker"></div>
</body>
</html>