【#文档大全网# 导语】以下是®文档大全网的小编为您整理的《JSP日历控件》,欢迎阅读!
<link rel="stylesheet" type="text/css" media="all" href="img2/calendar-win2k-cold-2.css" title="win2k-cold-2" />
<script type="text/javascript" src="img2/calendar.js"></script>
<script type="text/javascript" src="img2/calendar-zh.js"></script>
<script language="javascript" >
function doAction ( action )
{
document.theform.action.value = action ;
document.theform.submit() ;
}
function doSearch( method )
{
document.searchform.detail.value = method ;
document.searchform.submit() ;
}
var oldLink = null;
function selected(cal, date) {
cal.sel.value = date; // just update the date in the input field.
if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
cal.callCloseHandler();
}
function closeHandler(cal) {
cal.hide(); // hide the calendar
// cal.destroy();
calendar = null;
}
function showCalendar(id, format, showsTime, showsOtherMonths) {
var el = document.getElementById(id);
if (calendar != null) {
// we already have some calendar created
calendar.hide(); // so we hide it first.
} else {
var cal = new Calendar(true, null, selected, closeHandler);
if (typeof showsTime == "string") {
cal.showsTime = true;
cal.time24 = (showsTime == "24");
}
if (showsOtherMonths) {
cal.showsOtherMonths = true;
}
calendar = cal; // remember it in the global var
cal.setRange(1900, 2070); // min/max year allowed.
cal.create();
}
calendar.setDateFormat(format); // set the specified date format
calendar.parseDate(el.value); // try to parse the text in field
calendar.sel = el; // inform it what input field we use
// the reference element that we pass to showAtElement is the button that
// triggers the calendar. In this example we align the calendar bottom-right
// to the button.
calendar.showAtElement(el.nextSibling, "Br"); // show the calendar
return false;
}
var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;
function isDisabled(date) {
var today = new Date();
return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}
</script>
<input type=text readonly size=12 name="f_date" id=start value="<%=fbrq%>"><input type="reset" value="选择" onclick="return showCalendar('start', '%Y-%m-%d %H:%M', '24', true);">