日期控件(仿途家网)
<!DOCTYPE html>
<html>
<head>
<link href="~/jquery-ui-1.11.1.custom/jquery-ui.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/jquery-ui-1.11.1.custom/jquery-ui.min.js"></script>
<title></title>
</head>
<body>
<div>
开始日期:<input type="text" id="start" value="@( DateTime.Now.ToString("yyyy/MM/dd"))">
</div>
</body>
</html>
<script type="text/javascript">
var zstart = new Date("@start");
var zend = new Date("@end");
$("#start").datepicker({
defaultDate: null,
dateFormat: "yy/mm/dd",
//限制选择日期
beforeShowDay: function (date) {
if (date>=zstart&&date<=zend) {
return [false, 'CLOSED'];
} else {
return [true, ''];
}
},
minDate: 0
});
</script>