选择样式的日期时间js代码

大牛练成记:用JavaScript徒手写出一个日期选择插件 在现代Web应用程序中,日期选择器是一个非常常见的组件,用户可以使用它来选择特定的日期。在本篇文章中,我们将使用JavaScript和HTML来创建一个简单但功能强大的日期选择插件。这个日期选择插件是比较考验Js基本功的。点击输入框时,将显示日期选择器。日期选择器上方有一个年份和月份选择器,可以向左或向右切换。日期选择器下方是一个日期网格,用户可以通过点击来选择日期。当用户选择一个日期后,插件将自动将选定的日期填充到输入框中。 阅读详情

弹出选择日期效果(一)
<HTML>
<HEAD>
<TITLE>网页特效|Linkweb.cn/Js|---弹出选择日期效果(一)</TITLE>
<SCRIPT LANGUAGE=javascript>
function hide(){
showCalendar.style.display="none"
}
x=window.setTimeout ("hide()",1)

</SCRIPT>

<SCRIPT  LANGUAGE=vbscript>
''点击后显示日期控件
function button1_onclick()
showCalendar.style.display="inline"
if text1.value <> "" then
Calendar1.Value=text1.value

end if
end function

function Calendar1_Click()
''当选择日期后,把值显示到文本框

''以下是选择时间的格式
''text1.value =formatdatetime(Calendar1.Value,0)
text1.value =formatdatetime(Calendar1.Value,1)
''text1.value =formatdatetime(Calendar1.Value,2)
showCalendar.style.display="none"

end function

</SCRIPT>
<SCRIPT LANGUAGE=vbscript FOR=Calendar1 EVENT=Click>
Calendar1_Click()
</SCRIPT>

</HEAD>
<BODY>
在网页上直接调用控件选择时间的演示效果
<br>
注意:请确定本地机子上已经安装有CalendarACTIVEX控件
   
<br>
<INPUT id=text1 readonly name=text1 style="HEIGHT: 22px; WIDTH: 177px"><INPUT type="button" value="选择时间" id=button1 name=button1  onclick=" button1_onclick()"> 

<P>
<div id=showCalendar >
<OBJECT classid=clsid:8E27C92B-1264-101C-8A2F-040224009C02 id=Calendar1><PARAM NAME="_Version" VALUE="524288"><PARAM NAME="_ExtentX" VALUE="7620"><PARAM NAME="_ExtentY" VALUE="5080"><PARAM NAME="_StockProps" VALUE="1"><PARAM NAME="BackColor" VALUE="-2147483633"><PARAM NAME="Year" VALUE="2002"><PARAM NAME="Month" VALUE="4"><PARAM NAME="Day" VALUE="2"><PARAM NAME="DayLength" VALUE="0"><PARAM NAME="MonthLength" VALUE="0"><PARAM NAME="DayFontColor" VALUE="0"><PARAM NAME="FirstDay" VALUE="1"><PARAM NAME="GridCellEffect" VALUE="1"><PARAM NAME="GridFontColor" VALUE="10485760"><PARAM NAME="GridLinesColor" VALUE="-2147483632"><PARAM NAME="ShowDateSelectors" VALUE="-1"><PARAM NAME="ShowDays" VALUE="-1"><PARAM NAME="ShowHorizontalGrid" VALUE="-1"><PARAM NAME="ShowTitle" VALUE="-1"><PARAM NAME="ShowVerticalGrid" VALUE="-1"><PARAM NAME="TitleFontColor" VALUE="10485760"><PARAM NAME="ValueIsNull" VALUE="0"></OBJECT>
</div>

</BODY>
</HTML>

弹出选择日期效果(二)
 <html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效|Linkweb.cn/Js|---弹出选择日期效果(二)</title>
</head>

<body>
<script language="JavaScript">
<!-- Original:  Kedar R. Bhave (softricks@hotmail.com) -->
<!-- Web Site:  http://www.softricks.com -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- -->
<!-- modifications and customizations to work with the "overLIB" library: -->
<!-- Author:   James B. O'Connor (joconnor@nordenterprises.com) -->
<!-- Web Site: http://www.nordenterprises.com -->
<!-- developed for use with http://home-owners-assoc.com -->
<!-- Note: while overlib works fine with Netscape 4, this function does not work very well, since portions of the "over" div -->
<!--   end up under other fields on the form and cannot be seen.  If you really want to use this with NS4, -->
<!--   you'll need to change the positioning in the overlib() call to make sure the "over" div gets positioned -->
<!--   away from all other form fields -->
<!-- you can get overLIB from: -->
///  overLIB 3.50  --  This notice must remain untouched at all times.
///  Copyright Erik Bosrup 1998-2001. All rights reserved.
///  By Erik Bosrup (erik@bosrup.com).  Last modified 2001-08-28.
///  Portions by Dan Steinman (dansteinman.com). Additions by other people are
///  listed on the overLIB homepage.
///  Get the latest version at http://www.bosrup.com/web/overlib/

var weekend = [0,6];
var weekendColor = "#e0e0e0";
var fontface = "Verdana";
var fontsize = 8;   // in "pt" units; used with "font-size" style element

var gNow = new Date();
var ggWinContent;
var ggPosX = -1;
var ggPosY = -1;

Calendar.Months = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];

// Non-Leap year Month days..
Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// Leap year Month days..
Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

function Calendar(p_item, p_month, p_year, p_format) {
 if ((p_month == null) && (p_year == null)) return;

 if (p_month == null) {
  this.gMonthName = null;
  this.gMonth = null;
  this.gYearly = true;
 } else {
  this.gMonthName = Calendar.get_month(p_month);
  this.gMonth = new Number(p_month);
  this.gYearly = false;
 }

 this.gYear = p_year;
 this.gFormat = p_format;
 this.gBGColor = "white";
 this.gFGColor = "black";
 this.gTextColor = "black";
 this.gHeaderColor = "black";
 this.gReturnItem = p_item;
}

Calendar.get_month = Calendar_get_month;
Calendar.get_daysofmonth = Calendar_get_daysofmonth;
Calendar.calc_month_year = Calendar_calc_month_year;

function Calendar_get_month(monthNo) {
 return Calendar.Months[monthNo];
}

function Calendar_get_daysofmonth(monthNo, p_year) {
 /*
 Check for leap year ..
 1.Years evenly divisible by four are normally leap years, except for...
 2.Years also evenly divisible by 100 are not leap years, except for...
 3.Years also evenly divisible by 400 are leap years.
 */
 if ((p_year % 4) == 0) {
  if ((p_year % 100) == 0 && (p_year % 400) != 0)
   return Calendar.DOMonth[monthNo];
 
  return Calendar.lDOMonth[monthNo];
 } else
  return Calendar.DOMonth[monthNo];
}

function Calendar_calc_month_year(p_Month, p_Year, incr) {
 /*
 Will return an 1-D array with 1st element being the calculated month
 and second being the calculated year
 after applying the month increment/decrement as specified by 'incr' parameter.
 'incr' will normally have 1/-1 to navigate thru the months.
 */
 var ret_arr = new Array();
 
 if (incr == -1) {
  // B A C K W A R D
  if (p_Month == 0) {
   ret_arr[0] = 11;
   ret_arr[1] = parseInt(p_Year) - 1;
  }
  else {
   ret_arr[0] = parseInt(p_Month) - 1;
   ret_arr[1] = parseInt(p_Year);
  }
 } else if (incr == 1) {
  // F O R W A R D
  if (p_Month == 11) {
   ret_arr[0] = 0;
   ret_arr[1] = parseInt(p_Year) + 1;
  }
  else {
   ret_arr[0] = parseInt(p_Month) + 1;
   ret_arr[1] = parseInt(p_Year);
  }
 }
 
 return ret_arr;
}

function Calendar_calc_month_year(p_Month, p_Year, incr) {
 /*
 Will return an 1-D array with 1st element being the calculated month
 and second being the calculated year
 after applying the month increment/decrement as specified by 'incr' parameter.
 'incr' will normally have 1/-1 to navigate thru the months.
 */
 var ret_arr = new Array();
 
 if (incr == -1) {
  // B A C K W A R D
  if (p_Month == 0) {
   ret_arr[0] = 11;
   ret_arr[1] = parseInt(p_Year) - 1;
  }
  else {
   ret_arr[0] = parseInt(p_Month) - 1;
   ret_arr[1] = parseInt(p_Year);
  }
 } else if (incr == 1) {
  // F O R W A R D
  if (p_Month == 11) {
   ret_arr[0] = 0;
   ret_arr[1] = parseInt(p_Year) + 1;
  }
  else {
   ret_arr[0] = parseInt(p_Month) + 1;
   ret_arr[1] = parseInt(p_Year);
  }
 }
 
 return ret_arr;
}

// This is for compatibility with Navigator 3, we have to create and discard one object before the prototype object exists.
new Calendar();

Calendar.prototype.getMonthlyCalendarCode = function() {
 var vCode = "";
 var vHeader_Code = "";
 var vData_Code = "";
 
 // Begin Table Drawing code here..
 vCode += ("<div align=center><TABLE BORDER=1 BGCOLOR=/"" + this.gBGColor + "/" style='font-size:" + fontsize + "pt;'>");
 
 vHeader_Code = this.cal_header();
 vData_Code = this.cal_data();
 vCode += (vHeader_Code + vData_Code);
 
 vCode += "</TABLE></div>";
 
 return vCode;
}

Calendar.prototype.show = function() {
 var vCode = "";

 // build content into global var ggWinContent
 ggWinContent += ("<FONT FACE='" + fontface + "' ><B>");
 ggWinContent += (this.gMonthName + " " + this.gYear);
 ggWinContent += "</B><BR>";
 
 // Show navigation buttons
 var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
 var prevMM = prevMMYYYY[0];
 var prevYYYY = prevMMYYYY[1];

 var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
 var nextMM = nextMMYYYY[0];
 var nextYYYY = nextMMYYYY[1];
 
 ggWinContent += ("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0' style='font-size:" + fontsize + "pt;'><TR><TD ALIGN=center>");
 ggWinContent += ("[<A HREF=/"javascript:void(0);/" " +
  "onMouseOver=/"window.status='Go back one year'; return true;/" " +
  "onMouseOut=/"window.status=''; return true;/" " +
  "onClick=/"Build(" +
  "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "'" +
  ");" +
  "/"><<Year<//A>]</TD><TD ALIGN=center>");
 ggWinContent += ("[<A HREF=/"javascript:void(0);/" " +
  "onMouseOver=/"window.status='Go back one month'; return true;/" " +
  "onMouseOut=/"window.status=''; return true;/" " +
  "onClick=/"Build(" +
  "'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "'" +
  ");" +
  "/"><Mon<//A>]</TD><TD ALIGN=center>");
 ggWinContent += "       </TD><TD ALIGN=center>";
 ggWinContent += ("[<A HREF=/"javascript:void(0);/" " +
  "onMouseOver=/"window.status='Go forward one month'; return true;/" " +
  "onMouseOut=/"window.status=''; return true;/" " +
  "onClick=/"Build(" +
  "'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "'" +
  ");" +
  "/">Mon><//A>]</TD><TD ALIGN=center>");
 ggWinContent += ("[<A HREF=/"javascript:void(0);/" " +
  "onMouseOver=/"window.status='Go forward one year'; return true;/" " +
  "onMouseOut=/"window.status=''; return true;/" " +
  "onClick=/"Build(" +
  "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)+1) + "', '" + this.gFormat + "'" +
  ");" +
  "/">Year>><//A>]</TD></TR></TABLE><BR>");

 // Get the complete calendar code for the month, and add it to the
 // content var
 vCode = this.getMonthlyCalendarCode();
 ggWinContent += vCode;
}

Calendar.prototype.showY = function() {
 var vCode = "";
 var i;

 ggWinContent += "<FONT FACE='" + fontface + "' ><B>"
 ggWinContent += ("Year : " + this.gYear);
 ggWinContent += "</B><BR>";

 // Show navigation buttons
 var prevYYYY = parseInt(this.gYear) - 1;
 var nextYYYY = parseInt(this.gYear) + 1;
 
 ggWinContent += ("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0' style='font-size:" + fontsize + "pt;'><TR><TD ALIGN=center>");
 ggWinContent += ("[<A HREF=/"javascript:void(0);/" " +
  "onMouseOver=/"window.status='Go back one year'; return true;/" " +
  "onMouseOut=/"window.status=''; return true;/" " +
  "onClick=/"Build(" +
  "'" + this.gReturnItem + "', null, '" + prevYYYY + "', '" + this.gFormat + "'" +
  ");" +
  "/"><<Year<//A>]</TD><TD ALIGN=center>");
 ggWinContent += "       </TD><TD ALIGN=center>";
 ggWinContent += ("[<A HREF=/"javascript:void(0);/" " +
  "onMouseOver=/"window.status='Go forward one year'; return true;/" " +
  "onMouseOut=/"window.status=''; return true;/" " +
  "onClick=/"Build(" +
  "'" + this.gReturnItem + "', null, '" + nextYYYY + "', '" + this.gFormat + "'" +
  ");" +
  "/">Year>><//A>]</TD></TR></TABLE><BR>");

 // Get the complete calendar code for each month.
 // start a table and first row in the table
 ggWinContent += ("<TABLE WIDTH='100%' BORDER=0 CELLSPACING=0 CELLPADDING=5 style='font-size:" + fontsize + "pt;'><TR>");
 var j;
 for (i=0; i<12; i++) {
  // start the table cell
  ggWinContent += "<TD ALIGN='center' VALIGN='top'>";
  this.gMonth = i;
  this.gMonthName = Calendar.get_month(this.gMonth);
  vCode = this.getMonthlyCalendarCode();
  ggWinContent += (this.gMonthName + "/" + this.gYear + "<BR>");
  ggWinContent += vCode;
  ggWinContent += "</TD>";
  if (i == 3 || i == 7) {
   ggWinContent += "</TR><TR>";
   }

 }

 ggWinContent += "</TR></TABLE></font><BR>";
}

Calendar.prototype.cal_header = function() {
 var vCode = "";
 
 vCode = vCode + "<TR>";
 vCode = vCode + "<TD WIDTH='14%'><FONT FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sun</B></FONT></TD>";
 vCode = vCode + "<TD WIDTH='14%'><FONT FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Mon</B></FONT></TD>";
 vCode = vCode + "<TD WIDTH='14%'><FONT FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Tue</B></FONT></TD>";
 vCode = vCode + "<TD WIDTH='14%'><FONT FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Wed</B></FONT></TD>";
 vCode = vCode + "<TD WIDTH='14%'><FONT FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Thu</B></FONT></TD>";
 vCode = vCode + "<TD WIDTH='14%'><FONT FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Fri</B></FONT></TD>";
 vCode = vCode + "<TD WIDTH='16%'><FONT FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sat</B></FONT></TD>";
 vCode = vCode + "</TR>";
 
 return vCode;
}

Calendar.prototype.cal_data = function() {
 var vDate = new Date();
 vDate.setDate(1);
 vDate.setMonth(this.gMonth);
 vDate.setFullYear(this.gYear);

 var vFirstDay=vDate.getDay();
 var vDay=1;
 var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
 var vOnLastDay=0;
 var vCode = "";

 /*
 Get day for the 1st of the requested month/year..
 Place as many blank cells before the 1st day of the month as necessary.
 */
 vCode = vCode + "<TR>";
 for (i=0; i<vFirstDay; i++) {
  vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(i) + "><FONT FACE='" + fontface + "'> </FONT></TD>";
 }

 // Write rest of the 1st week
 for (j=vFirstDay; j<7; j++) {
  vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT FACE='" + fontface + "'>" +
   "<A HREF='javascript:void(0);' " +
    "onMouseOver=/"window.status='set date to " + this.format_data(vDay) + "'; return true;/" " +
    "onMouseOut=/"window.status=' '; return true;/" " +
    "onClick=/"document." + this.gReturnItem + ".value='" +
    this.format_data(vDay) +
    "';ggPosX=-1;ggPosY=-1;nd();nd();/">" +
    this.format_day(vDay) +
   "</A>" +
   "</FONT></TD>";
  vDay=vDay + 1;
 }
 vCode = vCode + "</TR>";

 // Write the rest of the weeks
 for (k=2; k<7; k++) {
  vCode = vCode + "<TR>";

  for (j=0; j<7; j++) {
   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT FACE='" + fontface + "'>" +
    "<A HREF='javascript:void(0);' " +
     "onMouseOver=/"window.status='set date to " + this.format_data(vDay) + "'; return true;/" " +
     "onMouseOut=/"window.status=' '; return true;/" " +
     "onClick=/"document." + this.gReturnItem + ".value='" +
     this.format_data(vDay) +
     "';window.scroll(0,ggPosY);ggPosX=-1;ggPosY=-1;nd();nd();/">" +
    this.format_day(vDay) +
    "</A>" +
    "</FONT></TD>";
   vDay=vDay + 1;

   if (vDay > vLastDay) {
    vOnLastDay = 1;
    break;
   }
  }

  if (j == 6)
   vCode = vCode + "</TR>";
  if (vOnLastDay == 1)
   break;
 }
 
 // Fill up the rest of last week with proper blanks, so that we get proper square blocks
 for (m=1; m<(7-j); m++) {
  if (this.gYearly)
   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) +
   "><FONT FACE='" + fontface + "' COLOR='gray'> </FONT></TD>";
  else
   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) +
   "><FONT FACE='" + fontface + "' COLOR='gray'>" + m + "</FONT></TD>";
 }
 
 return vCode;
}

Calendar.prototype.format_day = function(vday) {
 var vNowDay = gNow.getDate();
 var vNowMonth = gNow.getMonth();
 var vNowYear = gNow.getFullYear();

 if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
  return ("<FONT COLOR=/"RED/"><B>" + vday + "</B></FONT>");
 else
  return (vday);
}

Calendar.prototype.write_weekend_string = function(vday) {
 var i;

 // Return special formatting for the weekend day.
 for (i=0; i<weekend.length; i++) {
  if (vday == weekend[i])
   return (" BGCOLOR=/"" + weekendColor + "/"");
 }
 
 return "";
}

Calendar.prototype.format_data = function(p_day) {
 var vData;
 var vMonth = 1 + this.gMonth;
 vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;
 var vMon = Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();
 var vFMon = Calendar.get_month(this.gMonth).toUpperCase();
 var vY4 = new String(this.gYear);
 var vY2 = new String(this.gYear.substr(2,2));
 var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;

 switch (this.gFormat) {
  case "MM//DD//YYYY" :
   vData = vMonth + "//" + vDD + "//" + vY4;
   break;
  case "MM//DD//YY" :
   vData = vMonth + "//" + vDD + "//" + vY2;
   break;
  case "MM-DD-YYYY" :
   vData = vMonth + "-" + vDD + "-" + vY4;
   break;
  case "YYYY-MM-DD" :
   vData = vY4 + "-" + vMonth + "-" + vDD;
   break;
  case "MM-DD-YY" :
   vData = vMonth + "-" + vDD + "-" + vY2;
   break;
  case "DD//MON//YYYY" :
   vData = vDD + "//" + vMon + "//" + vY4;
   break;
  case "DD//MON//YY" :
   vData = vDD + "//" + vMon + "//" + vY2;
   break;
  case "DD-MON-YYYY" :
   vData = vDD + "-" + vMon + "-" + vY4;
   break;
  case "DD-MON-YY" :
   vData = vDD + "-" + vMon + "-" + vY2;
   break;
  case "DD//MONTH//YYYY" :
   vData = vDD + "//" + vFMon + "//" + vY4;
   break;
  case "DD//MONTH//YY" :
   vData = vDD + "//" + vFMon + "//" + vY2;
   break;
  case "DD-MONTH-YYYY" :
   vData = vDD + "-" + vFMon + "-" + vY4;
   break;
  case "DD-MONTH-YY" :
   vData = vDD + "-" + vFMon + "-" + vY2;
   break;
  case "DD//MM//YYYY" :
   vData = vDD + "//" + vMonth + "//" + vY4;
   break;
  case "DD//MM//YY" :
   vData = vDD + "//" + vMonth + "//" + vY2;
   break;
  case "DD-MM-YYYY" :
   vData = vDD + "-" + vMonth + "-" + vY4;
   break;
  case "DD-MM-YY" :
   vData = vDD + "-" + vMonth + "-" + vY2;
   break;
  default :
   vData = vMonth + "//" + vDD + "//" + vY4;
 }

 return vData;
}

function Build(p_item, p_month, p_year, p_format) {
 gCal = new Calendar(p_item, p_month, p_year, p_format);

 // Customize your Calendar here..
 gCal.gBGColor="white";
 gCal.gLinkColor="black";
 gCal.gTextColor="black";
 gCal.gHeaderColor="darkgreen";

 // initialize the content string
 ggWinContent = "";

 // Choose appropriate show function
 if (gCal.gYearly) {
  // and, since the yearly calendar is so large, override the positioning and fontsize
  // warning: in IE6, it appears that "select" fields on the form will still show
  // through the "over" div; Note: you can set these variables as part of the onClick
  // javascript code before you call the show_yearly_calendar function
  if (ggPosX == -1) ggPosX = 10;
  if (ggPosY == -1) ggPosY = 10;
  if (fontsize == 8) fontsize = 6;
  // generate the calendar
  gCal.showY();
  }
 else {
  gCal.show();
  }

 // if this is the first calendar popup, use autopositioning with an offset
 if (ggPosX == -1 && ggPosY == -1) {
  overlib(ggWinContent, AUTOSTATUSCAP, STICKY, CLOSECLICK, CSSSTYLE,
   TEXTSIZEUNIT, "pt", TEXTSIZE, 8, CAPTIONSIZEUNIT, "pt", CAPTIONSIZE, 8, CLOSESIZEUNIT, "pt", CLOSESIZE, 8,
   CAPTION, "Select a date", OFFSETX, 20, OFFSETY, -20);
  // save where the 'over' div ended up; we want to stay in the same place if the user
  // clicks on one of the year or month navigation links
  if ( (ns4) || (ie4) ) {
          ggPosX = parseInt(over.left);
          ggPosY = parseInt(over.top);
   } else if (ns6) {
   ggPosX = parseInt(over.style.left);
   ggPosY = parseInt(over.style.top);
   }
  }
 else {
  // we have a saved X & Y position, so use those with the FIXX and FIXY options
  overlib(ggWinContent, AUTOSTATUSCAP, STICKY, CLOSECLICK, CSSSTYLE,
   TEXTSIZEUNIT, "pt", TEXTSIZE, 8, CAPTIONSIZEUNIT, "pt", CAPTIONSIZE, 8, CLOSESIZEUNIT, "pt", CLOSESIZE, 8,
   CAPTION, "Select a date", FIXX, ggPosX, FIXY, ggPosY);
  }
 window.scroll(ggPosX, ggPosY);
}

function show_calendar() {
 /*
  p_month : 0-11 for Jan-Dec; 12 for All Months.
  p_year : 4-digit year
  p_format: Date format (mm/dd/yyyy, dd/mm/yy, ...)
  p_item : Return Item.
 */

 p_item = arguments[0];
 if (arguments[1] == null)
  p_month = new String(gNow.getMonth());
 else
  p_month = arguments[1];
 if (arguments[2] == "" || arguments[2] == null)
  p_year = new String(gNow.getFullYear().toString());
 else
  p_year = arguments[2];
 if (arguments[3] == null)
  p_format = "YYYY-MM-DD";
 else
  p_format = arguments[3];

 Build(p_item, p_month, p_year, p_format);
}
/*
Yearly Calendar Code Starts here
*/
function show_yearly_calendar() {
 // Load the defaults..
 //if (p_year == null || p_year == "")
 // p_year = new String(gNow.getFullYear().toString());
 //if (p_format == null || p_format == "")
 // p_format = "YYYY-MM-DD";

 p_item = arguments[0];
 if (arguments[1] == "" || arguments[1] == null)
  p_year = new String(gNow.getFullYear().toString());
 else
  p_year = arguments[1];
 if (arguments[2] == null)
  p_format = "YYYY-MM-DD";
 else
  p_format = arguments[2];

 Build(p_item, null, p_year, p_format);
}
</script>
<script language="JavaScript">
/////////////////////////////////////////////////////////////////////////////////////
///  overLIB 3.50  --  This notice must remain untouched at all times.
///  Copyright Erik Bosrup 1998-2001. All rights reserved.
///  THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL!
var INARRAY=1;
var CAPARRAY=2;
var STICKY=3;
var BACKGROUND=4;
var NOCLOSE=5;
var CAPTION=6;
var LEFT=7;
var RIGHT=8;
var CENTER=9;
var OFFSETX=10;
var OFFSETY=11;
var FGCOLOR=12;
var BGCOLOR=13;
var TEXTCOLOR=14;
var CAPCOLOR=15;
var CLOSECOLOR=16;
var WIDTH=17;
var BORDER=18;
var STATUS=19;
var AUTOSTATUS=20;
var AUTOSTATUSCAP=21;
var HEIGHT=22;
var CLOSETEXT=23;
var SNAPX=24;
var SNAPY=25;
var FIXX=26;
var FIXY=27;
var FGBACKGROUND=28;
var BGBACKGROUND=29;
var PADX=30;// PADX2 out
var PADY=31;// PADY2 out
var FULLHTML=34;
var ABOVE=35;
var BELOW=36;
var CAPICON=37;
var TEXTFONT=38;
var CAPTIONFONT=39;
var CLOSEFONT=40;
var TEXTSIZE=41;
var CAPTIONSIZE=42;
var CLOSESIZE=43;
var FRAME=44;
var TIMEOUT=45;
var FUNCTION=46;
var DELAY=47;
var HAUTO=48;
var VAUTO=49;
var CLOSECLICK=50;
var CSSOFF=51;
var CSSSTYLE=52;
var CSSCLASS=53;
var FGCLASS=54;
var BGCLASS=55;
var TEXTFONTCLASS=56;
var CAPTIONFONTCLASS=57;
var CLOSEFONTCLASS=58;
var PADUNIT=59;
var HEIGHTUNIT=60;
var WIDTHUNIT=61;
var TEXTSIZEUNIT=62;
var TEXTDECORATION=63;
var TEXTSTYLE=64;
var TEXTWEIGHT=65;
var CAPTIONSIZEUNIT=66;
var CAPTIONDECORATION=67;
var CAPTIONSTYLE=68;
var CAPTIONWEIGHT=69;
var CLOSESIZEUNIT=70;
var CLOSEDECORATION=71;
var CLOSESTYLE=72;
var CLOSEWEIGHT=73;
if(typeof ol_fgcolor=='undefined'){var ol_fgcolor="#CCCCFF";}
if(typeof ol_bgcolor=='undefined'){var ol_bgcolor="#333399";}
if(typeof ol_textcolor=='undefined'){var ol_textcolor="#000000";}
if(typeof ol_capcolor=='undefined'){var ol_capcolor="#FFFFFF";}
if(typeof ol_closecolor=='undefined'){var ol_closecolor="#9999FF";}
if(typeof ol_textfont=='undefined'){var ol_textfont="Verdana,Arial,Helvetica";}
if(typeof ol_captionfont=='undefined'){var ol_captionfont="Verdana,Arial,Helvetica";}
if(typeof ol_closefont=='undefined'){var ol_closefont="Verdana,Arial,Helvetica";}
if(typeof ol_textsize=='undefined'){var ol_textsize="1";}
if(typeof ol_captionsize=='undefined'){var ol_captionsize="1";}
if(typeof ol_closesize=='undefined'){var ol_closesize="1";}
if(typeof ol_width=='undefined'){var ol_width="200";}
if(typeof ol_border=='undefined'){var ol_border="1";}
if(typeof ol_offsetx=='undefined'){var ol_offsetx=10;}
if(typeof ol_offsety=='undefined'){var ol_offsety=10;}
if(typeof ol_text=='undefined'){var ol_text="Default Text";}
if(typeof ol_cap=='undefined'){var ol_cap="";}
if(typeof ol_sticky=='undefined'){var ol_sticky=0;}
if(typeof ol_background=='undefined'){var ol_background="";}
if(typeof ol_close=='undefined'){var ol_close="Close";}
if(typeof ol_hpos=='undefined'){var ol_hpos=8;}
if(typeof ol_status=='undefined'){var ol_status="";}
if(typeof ol_autostatus=='undefined'){var ol_autostatus=0;}
if(typeof ol_height=='undefined'){var ol_height=-1;}
if(typeof ol_snapx=='undefined'){var ol_snapx=0;}
if(typeof ol_snapy=='undefined'){var ol_snapy=0;}
if(typeof ol_fixx=='undefined'){var ol_fixx=-1;}
if(typeof ol_fixy=='undefined'){var ol_fixy=-1;}
if(typeof ol_fgbackground=='undefined'){var ol_fgbackground="";}
if(typeof ol_bgbackground=='undefined'){var ol_bgbackground="";}
if(typeof ol_padxl=='undefined'){var ol_padxl=1;}
if(typeof ol_padxr=='undefined'){var ol_padxr=1;}
if(typeof ol_padyt=='undefined'){var ol_padyt=1;}
if(typeof ol_padyb=='undefined'){var ol_padyb=1;}
if(typeof ol_fullhtml=='undefined'){var ol_fullhtml=0;}
if(typeof ol_vpos=='undefined'){var ol_vpos=36;}
if(typeof ol_aboveheight=='undefined'){var ol_aboveheight=0;}
if(typeof ol_caption=='undefined'){var ol_capicon="";}
if(typeof ol_frame=='undefined'){var ol_frame=self;}
if(typeof ol_timeout=='undefined'){var ol_timeout=0;}
if(typeof ol_function=='undefined'){var ol_function=Function();}
if(typeof ol_delay=='undefined'){var ol_delay=0;}
if(typeof ol_hauto=='undefined'){var ol_hauto=0;}
if(typeof ol_vauto=='undefined'){var ol_vauto=0;}
if(typeof ol_closeclick=='undefined'){var ol_closeclick=0;}
if(typeof ol_css=='undefined'){var ol_css=51;}
if(typeof ol_fgclass=='undefined'){var ol_fgclass="";}
if(typeof ol_bgclass=='undefined'){var ol_bgclass="";}
if(typeof ol_textfontclass=='undefined'){var ol_textfontclass="";}
if(typeof ol_captionfontclass=='undefined'){var ol_captionfontclass="";}
if(typeof ol_closefontclass=='undefined'){var ol_closefontclass="";}
if(typeof ol_padunit=='undefined'){var ol_padunit="px";}
if(typeof ol_heightunit=='undefined'){var ol_heightunit="px";}
if(typeof ol_widthunit=='undefined'){var ol_widthunit="px";}
if(typeof ol_textsizeunit=='undefined'){var ol_textsizeunit="px";}
if(typeof ol_textdecoration=='undefined'){var ol_textdecoration="none";}
if(typeof ol_textstyle=='undefined'){var ol_textstyle="normal";}
if(typeof ol_textweight=='undefined'){var ol_textweight="normal";}
if(typeof ol_captionsizeunit=='undefined'){var ol_captionsizeunit="px";}
if(typeof ol_captiondecoration=='undefined'){var ol_captiondecoration="none";}
if(typeof ol_captionstyle=='undefined'){var ol_captionstyle="normal";}
if(typeof ol_captionweight=='undefined'){var ol_captionweight="bold";}
if(typeof ol_closesizeunit=='undefined'){var ol_closesizeunit="px";}
if(typeof ol_closedecoration=='undefined'){var ol_closedecoration="none";}
if(typeof ol_closestyle=='undefined'){var ol_closestyle="normal";}
if(typeof ol_closeweight=='undefined'){var ol_closeweight="normal";}
if(typeof ol_texts=='undefined'){var ol_texts=new Array("Text 0", "Text 1");}
if(typeof ol_caps=='undefined'){var ol_caps=new Array("Caption 0", "Caption 1");}
var otext="";
var ocap="";
var osticky=0;
var obackground="";
var oclose="Close";
var ohpos=8;
var ooffsetx=2;
var ooffsety=2;
var ofgcolor="";
var obgcolor="";
var otextcolor="";
var ocapcolor="";
var oclosecolor="";
var owidth=100;
var oborder=1;
var ostatus="";
var oautostatus=0;
var oheight=-1;
var osnapx=0;
var osnapy=0;
var ofixx=-1;
var ofixy=-1;
var ofgbackground="";
var obgbackground="";
var opadxl=0;
var opadxr=0;
var opadyt=0;
var opadyb=0;
var ofullhtml=0;
var ovpos=36;
var oaboveheight=0;
var ocapicon="";
var otextfont="Verdana,Arial,Helvetica";
var ocaptionfont="Verdana,Arial,Helvetica";
var oclosefont="Verdana,Arial,Helvetica";
var otextsize="1";
var ocaptionsize="1";
var oclosesize="1";
var oframe=self;
var otimeout=0;
var otimerid=0;
var oallowmove=0;
var ofunction=Function();
var odelay=0;
var odelayid=0;
var ohauto=0;
var ovauto=0;
var ocloseclick=0;
var ocss=51;
var ofgclass="";
var obgclass="";
var otextfontclass="";
var ocaptionfontclass="";
var oclosefontclass="";
var opadunit="px";
var oheightunit="px";
var owidthunit="px";
var otextsizeunit="px";
var otextdecoration="";
var otextstyle="";
var otextweight="";
var ocaptionsizeunit="px";
var ocaptiondecoration="";
var ocaptionstyle="";
var ocaptionweight="";
var oclosesizeunit="px";
var oclosedecoration="";
var oclosestyle="";
var ocloseweight="";
var ox=0;
var oy=0;
var oallow=0;
var oshowingsticky=0;
var oremovecounter=0;
var over=null;
var ns4=(document.layers)? true:false;
var ns6=(document.getElementById)? true:false;
var ie4=(document.all)? true:false;
var ie5=false;
if(ie4){
if((navigator.userAgent.indexOf('MSIE 5')> 0)||(navigator.userAgent.indexOf('MSIE 6')> 0)){
ie5=true;
}
if(ns6){
ns6=false;
}
}
if((ns4)||(ie4)||(ns6)){
document.onmousemove=mouseMove
if(ns4)document.captureEvents(Event.MOUSEMOVE)
}else{
overlib=no_overlib;
nd=no_overlib;
ver3fix=true;
}
function no_overlib(){
return ver3fix;
}
function overlib(){
otext=ol_text;
ocap=ol_cap;
osticky=ol_sticky;
obackground=ol_background;
oclose=ol_close;
ohpos=ol_hpos;
ooffsetx=ol_offsetx;
ooffsety=ol_offsety;
ofgcolor=ol_fgcolor;
obgcolor=ol_bgcolor;
otextcolor=ol_textcolor;
ocapcolor=ol_capcolor;
oclosecolor=ol_closecolor;
owidth=ol_width;
oborder=ol_border;
ostatus=ol_status;
oautostatus=ol_autostatus;
oheight=ol_height;
osnapx=ol_snapx;
osnapy=ol_snapy;
ofixx=ol_fixx;
ofixy=ol_fixy;
ofgbackground=ol_fgbackground;
obgbackground=ol_bgbackground;
opadxl=ol_padxl;
opadxr=ol_padxr;
opadyt=ol_padyt;
opadyb=ol_padyb;
ofullhtml=ol_fullhtml;
ovpos=ol_vpos;
oaboveheight=ol_aboveheight;
ocapicon=ol_capicon;
otextfont=ol_textfont;
ocaptionfont=ol_captionfont;
oclosefont=ol_closefont;
otextsize=ol_textsize;
ocaptionsize=ol_captionsize;
oclosesize=ol_closesize;
otimeout=ol_timeout;
ofunction=ol_function;
odelay=ol_delay;
ohauto=ol_hauto;
ovauto=ol_vauto;
ocloseclick=ol_closeclick;
ocss=ol_css;
ofgclass=ol_fgclass;
obgclass=ol_bgclass;
otextfontclass=ol_textfontclass;
ocaptionfontclass=ol_captionfontclass;
oclosefontclass=ol_closefontclass;
opadunit=ol_padunit;
oheightunit=ol_heightunit;
owidthunit=ol_widthunit;
otextsizeunit=ol_textsizeunit;
otextdecoration=ol_textdecoration;
otextstyle=ol_textstyle;
otextweight=ol_textweight;
ocaptionsizeunit=ol_captionsizeunit;
ocaptiondecoration=ol_captiondecoration;
ocaptionstyle=ol_captionstyle;
ocaptionweight=ol_captionweight;
oclosesizeunit=ol_closesizeunit;
oclosedecoration=ol_closedecoration;
oclosestyle=ol_closestyle;
ocloseweight=ol_closeweight;
if((ns4)||(ie4)||(ns6)){
oframe=ol_frame;
if(ns4)over=oframe.document.overDiv
if(ie4)over=oframe.overDiv.style
if(ns6)over=oframe.document.getElementById("overDiv");
}
var c=-1;
var ar=arguments;
for(i=0;i < ar.length;i++){
if(c < 0){
if(ar[i]==1){
otext=ol_texts[ar[++i]];
}else{
otext=ar[i];
}
c=0;
}else{
if(ar[i]==1){otext=ol_texts[ar[++i]];continue;}
if(ar[i]==2){ocap=ol_caps[ar[++i]];continue;}
if(ar[i]==3){osticky=1;continue;}
if(ar[i]==4){obackground=ar[++i];continue;}
if(ar[i]==NOCLOSE){oclose="";continue;}
if(ar[i]==6){ocap=ar[++i];continue;}
if(ar[i]==9 || ar[i]==7 || ar[i]==8){ohpos=ar[i];continue;}
if(ar[i]==10){ooffsetx=ar[++i];continue;}
if(ar[i]==11){ooffsety=ar[++i];continue;}
if(ar[i]==12){ofgcolor=ar[++i];continue;}
if(ar[i]==13){obgcolor=ar[++i];continue;}
if(ar[i]==14){otextcolor=ar[++i];continue;}
if(ar[i]==15){ocapcolor=ar[++i];continue;}
if(ar[i]==16){oclosecolor=ar[++i];continue;}
if(ar[i]==17){owidth=ar[++i];continue;}
if(ar[i]==18){oborder=ar[++i];continue;}
if(ar[i]==19){ostatus=ar[++i];continue;}
if(ar[i]==20){oautostatus=1;continue;}
if(ar[i]==21){oautostatus=2;continue;}
if(ar[i]==22){oheight=ar[++i];oaboveheight=ar[i];continue;}// Same param again.
if(ar[i]==23){oclose=ar[++i];continue;}
if(ar[i]==24){osnapx=ar[++i];continue;}
if(ar[i]==25){osnapy=ar[++i];continue;}
if(ar[i]==26){ofixx=ar[++i];continue;}
if(ar[i]==27){ofixy=ar[++i];continue;}
if(ar[i]==28){ofgbackground=ar[++i];continue;}
if(ar[i]==29){obgbackground=ar[++i];continue;}
if(ar[i]==30){opadxl=ar[++i];opadxr=ar[++i];continue;}
if(ar[i]==31){opadyt=ar[++i];opadyb=ar[++i];continue;}
if(ar[i]==34){ofullhtml=1;continue;}
if(ar[i]==36 || ar[i]==35){ovpos=ar[i];continue;}
if(ar[i]==37){ocapicon=ar[++i];continue;}
if(ar[i]==38){otextfont=ar[++i];continue;}
if(ar[i]==39){ocaptionfont=ar[++i];continue;}
if(ar[i]==40){oclosefont=ar[++i];continue;}
if(ar[i]==41){otextsize=ar[++i];continue;}
if(ar[i]==42){ocaptionsize=ar[++i];continue;}
if(ar[i]==43){oclosesize=ar[++i];continue;}
if(ar[i]==44){opt_FRAME(ar[++i]);continue;}
if(ar[i]==45){otimeout=ar[++i];continue;}
if(ar[i]==46){opt_FUNCTION(ar[++i]);continue;}
if(ar[i]==47){odelay=ar[++i];continue;}
if(ar[i]==48){ohauto=(ohauto==0)? 1 : 0;continue;}
if(ar[i]==49){ovauto=(ovauto==0)? 1 : 0;continue;}
if(ar[i]==50){ocloseclick=(ocloseclick==0)? 1 : 0;continue;}
if(ar[i]==51){ocss=ar[i];continue;}
if(ar[i]==52){ocss=ar[i];continue;}
if(ar[i]==53){ocss=ar[i];continue;}
if(ar[i]==54){ofgclass=ar[++i];continue;}
if(ar[i]==55){obgclass=ar[++i];continue;}
if(ar[i]==56){otextfontclass=ar[++i];continue;}
if(ar[i]==57){ocaptionfontclass=ar[++i];continue;}
if(ar[i]==58){oclosefontclass=ar[++i];continue;}
if(ar[i]==59){opadunit=ar[++i];continue;}
if(ar[i]==60){oheightunit=ar[++i];continue;}
if(ar[i]==61){owidthunit=ar[++i];continue;}
if(ar[i]==62){otextsizeunit=ar[++i];continue;}
if(ar[i]==63){otextdecoration=ar[++i];continue;}
if(ar[i]==64){otextstyle=ar[++i];continue;}
if(ar[i]==65){otextweight=ar[++i];continue;}
if(ar[i]==66){ocaptionsizeunit=ar[++i];continue;}
if(ar[i]==67){ocaptiondecoration=ar[++i];continue;}
if(ar[i]==68){ocaptionstyle=ar[++i];continue;}
if(ar[i]==69){ocaptionweight=ar[++i];continue;}
if(ar[i]==70){oclosesizeunit=ar[++i];continue;}
if(ar[i]==71){oclosedecoration=ar[++i];continue;}
if(ar[i]==72){oclosestyle=ar[++i];continue;}
if(ar[i]==73){ocloseweight=ar[++i];continue;}
}
}
if(odelay==0){
return overlib350();
}else{
odelayid=setTimeout("overlib350()", odelay);
if(osticky){
return false;
}else{
return true;
}
}
}
function nd(){
if(oremovecounter >=1){oshowingsticky=0};
if((ns4)||(ie4)||(ns6)){
if(oshowingsticky==0){
oallowmove=0;
if(over !=null)hideObject(over);
}else{
oremovecounter++;
}
}
return true;
}
function overlib350(){
var layerhtml;
if(obackground !="" || ofullhtml){
layerhtml=ol_content_background(otext, obackground, ofullhtml);
}else{
if(ofgbackground !="" && ocss==CSSOFF){
ofgbackground="BACKGROUND=/""+ofgbackground+"/"";
}
if(obgbackground !="" && ocss==CSSOFF){
obgbackground="BACKGROUND=/""+obgbackground+"/"";
}
if(ofgcolor !="" && ocss==CSSOFF){
ofgcolor="BGCOLOR=/""+ofgcolor+"/"";
}
if(obgcolor !="" && ocss==CSSOFF){
obgcolor="BGCOLOR=/""+obgcolor+"/"";
}
if(oheight > 0 && ocss==51){
oheight="HEIGHT=" + oheight;
}else{
oheight="";
}
if(ocap==""){
layerhtml=ol_content_simple(otext);
}else{
if(osticky){
layerhtml=ol_content_caption(otext, ocap, oclose);
}else{
layerhtml=ol_content_caption(otext, ocap, "");
}
}
}
if(osticky){
oshowingsticky=1;
oremovecounter=0;
}
layerWrite(layerhtml);
if(oautostatus > 0){
ostatus=otext;
if(oautostatus > 1){
ostatus=ocap;
}
}
oallowmove=0;
if(otimeout > 0){
if(otimerid > 0)clearTimeout(otimerid);
otimerid=setTimeout("cClick()", otimeout);
}
disp(ostatus);
if(osticky){
oallowmove=0;
return false;
}else{
return true;
}
}
function ol_content_simple(text){
if(ocss==CSSCLASS)txt="<TABLE WIDTH="+owidth+" BORDER=0 CELLPADDING="+oborder+" CELLSPACING=0 class=/""+obgclass+"/"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 class=/""+ofgclass+"/"><TR><TD VALIGN=TOP><FONT class=/""+otextfontclass+"/">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
if(ocss==CSSSTYLE)txt="<TABLE WIDTH="+owidth+" BORDER=0 CELLPADDING="+oborder+" CELLSPACING=0 style=/"background-color: "+obgcolor+";height: "+oheight+oheightunit+";/"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 style=/"color: "+ofgcolor+";background-color: "+ofgcolor+";height: "+oheight+oheightunit+";/"><TR><TD VALIGN=TOP><FONT style=/"font-family: "+otextfont+";color: "+otextcolor+";font-size: "+otextsize+otextsizeunit+";text-decoration: "+otextdecoration+";font-weight: "+otextweight+";font-style:"+otextstyle+"/">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
if(ocss==CSSOFF)txt="<TABLE WIDTH="+owidth+" BORDER=0 CELLPADDING="+oborder+" CELLSPACING=0 "+obgcolor+" "+oheight+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 "+ofgcolor+" "+ofgbackground+" "+oheight+"><TR><TD VALIGN=TOP><FONT FACE=/""+otextfont+"/" COLOR=/""+otextcolor+"/" SIZE=/""+otextsize+"/">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
set_background("");
return txt;
}
function ol_content_caption(text, title, close){
closing="";
closeevent="onMouseOver";
if(ocloseclick==1)closeevent="onClick";
if(ocapicon !="")ocapicon="<IMG SRC=/""+ocapicon+"/"> ";
if(close !=""){
if(ocss==CSSCLASS)closing="<TD ALIGN=RIGHT><A HREF=/"//" "+closeevent+"=/"return cClick();/" class=/""+oclosefontclass+"/">"+close+"</A></TD>";
if(ocss==CSSSTYLE)closing="<TD ALIGN=RIGHT><A HREF=/"//" "+closeevent+"=/"return cClick();/" style=/"color: "+oclosecolor+";font-family: "+oclosefont+";font-size: "+oclosesize+oclosesizeunit+";text-decoration: "+oclosedecoration+";font-weight: "+ocloseweight+";font-style:"+oclosestyle+";/">"+close+"</A></TD>";
if(ocss==CSSOFF)closing="<TD ALIGN=RIGHT><A HREF=/"//" "+closeevent+"=/"return cClick();/"><FONT COLOR=/""+oclosecolor+"/" FACE=/""+oclosefont+"/" SIZE=/""+oclosesize+"/">"+close+"</FONT></A></TD>";
}
if(ocss==CSSCLASS)txt="<TABLE WIDTH="+owidth+" BORDER=0 CELLPADDING="+oborder+" CELLSPACING=0 class=/""+obgclass+"/"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><FONT class=/""+ocaptionfontclass+"/">"+ocapicon+title+"</FONT></TD>"+closing+"</TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 class=/""+ofgclass+"/"><TR><TD VALIGN=TOP><FONT class=/""+otextfontclass+"/">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
if(ocss==CSSSTYLE)txt="<TABLE WIDTH="+owidth+" BORDER=0 CELLPADDING="+oborder+" CELLSPACING=0 style=/"background-color: "+obgcolor+";background-image: url("+obgbackground+");height: "+oheight+oheightunit+";/"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><FONT style=/"font-family: "+ocaptionfont+";color: "+ocapcolor+";font-size: "+ocaptionsize+ocaptionsizeunit+";font-weight: "+ocaptionweight+";font-style: "+ocaptionstyle+";/">"+ocapicon+title+"</FONT></TD>"+closing+"</TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 style=/"color: "+ofgcolor+";background-color: "+ofgcolor+";height: "+oheight+oheightunit+";/"><TR><TD VALIGN=TOP><FONT style=/"font-family: "+otextfont+";color: "+otextcolor+";font-size: "+otextsize+otextsizeunit+";text-decoration: "+otextdecoration+";font-weight: "+otextweight+";font-style:"+otextstyle+"/">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
if(ocss==CSSOFF)txt="<TABLE WIDTH="+owidth+" BORDER=0 CELLPADDING="+oborder+" CELLSPACING=0 "+obgcolor+" "+obgbackground+" "+oheight+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><B><FONT COLOR=/""+ocapcolor+"/" FACE=/""+ocaptionfont+"/" SIZE=/""+ocaptionsize+"/">"+ocapicon+title+"</FONT></B></TD>"+closing+"</TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 "+ofgcolor+" "+ofgbackground+" "+oheight+"><TR><TD VALIGN=TOP><FONT COLOR=/""+otextcolor+"/" FACE=/""+otextfont+"/" SIZE=/""+otextsize+"/">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
set_background("");
return txt;
}
function ol_content_background(text, picture, hasfullhtml){
if(hasfullhtml){
txt=text;
}else{
if(ocss==CSSCLASS)txt="<TABLE WIDTH="+owidth+owidthunit+" BORDER=0 CELLPADDING=0 CELLSPACING=0 HEIGHT="+oheight+oheightunit+"><TR><TD COLSPAN=3 HEIGHT="+opadyt+opadunit+"></TD></TR><TR><TD WIDTH="+opadxl+opadunit+"></TD><TD VALIGN=TOP WIDTH="+(owidth-opadxl-opadxr)+opadunit+"><FONT class=/""+otextfontclass+"/">"+text+"</FONT></TD><TD WIDTH="+opadxr+opadunit+"></TD></TR><TR><TD COLSPAN=3 HEIGHT="+opadyb+opadunit+"></TD></TR></TABLE>";
if(ocss==CSSSTYLE)txt="<TABLE WIDTH="+owidth+owidthunit+" BORDER=0 CELLPADDING=0 CELLSPACING=0 HEIGHT="+oheight+oheightunit+"><TR><TD COLSPAN=3 HEIGHT="+opadyt+opadunit+"></TD></TR><TR><TD WIDTH="+opadxl+opadunit+"></TD><TD VALIGN=TOP WIDTH="+(owidth-opadxl-opadxr)+opadunit+"><FONT style=/"font-family: "+otextfont+";color: "+otextcolor+";font-size: "+otextsize+otextsizeunit+";/">"+text+"</FONT></TD><TD WIDTH="+opadxr+opadunit+"></TD></TR><TR><TD COLSPAN=3 HEIGHT="+opadyb+opadunit+"></TD></TR></TABLE>";
if(ocss==CSSOFF)txt="<TABLE WIDTH="+owidth+" BORDER=0 CELLPADDING=0 CELLSPACING=0 HEIGHT="+oheight+"><TR><TD COLSPAN=3 HEIGHT="+opadyt+"></TD></TR><TR><TD WIDTH="+opadxl+"></TD><TD VALIGN=TOP WIDTH="+(owidth-opadxl-opadxr)+"><FONT FACE=/""+otextfont+"/" COLOR=/""+otextcolor+"/" SIZE=/""+otextsize+"/">"+text+"</FONT></TD><TD WIDTH="+opadxr+"></TD></TR><TR><TD COLSPAN=3 HEIGHT="+opadyb+"></TD></TR></TABLE>";
}
set_background(picture);
return txt;
}
function set_background(pic){
if(pic==""){
if(ie4)over.backgroundImage="none";
if(ns6)over.style.backgroundImage="none";
}else{
if(ns4){
over.background.src=pic;
}else if(ie4){
over.backgroundImage="url("+pic+")";
}else if(ns6){
over.style.backgroundImage="url("+pic+")";
}
}
}
function disp(statustext){
if((ns4)||(ie4)||(ns6)){
if(oallowmove==0){
placeLayer();
showObject(over);
oallowmove=1;
}
}
if(statustext !=""){
self.status=statustext;
}
}
function placeLayer(){
var placeX, placeY;
if(ofixx > -1){
placeX=ofixx;
}else{
winoffset=(ie4)? oframe.document.body.scrollLeft : oframe.pageXOffset;
if(ie4)iwidth=oframe.document.body.clientWidth;
if(ns4)iwidth=oframe.innerWidth;// was screwed in mozilla, fixed now?
if(ns6)iwidth=oframe.outerWidth;
if(ohauto==1){
if((ox - winoffset)>((eval(iwidth))/ 2)){
ohpos=7;
}else{
ohpos=8;
}
}
if(ohpos==9){// Center
placeX=ox+ooffsetx-(owidth/2);
}
if(ohpos==8){// Right
placeX=ox+ooffsetx;
if((eval(placeX)+ eval(owidth))>(winoffset + iwidth)){
placeX=iwidth + winoffset - owidth;
if(placeX < 0)placeX=0;
}
}
if(ohpos==7){// Left
placeX=ox-ooffsetx-owidth;
if(placeX < winoffset)placeX=winoffset;
}
if(osnapx > 1){
var snapping=placeX % osnapx;
if(ohpos==7){
placeX=placeX -(osnapx + snapping);
}else{
placeX=placeX +(osnapx - snapping);
}
if(placeX < winoffset)placeX=winoffset;
}
}
if(ofixy > -1){
placeY=ofixy;
}else{
scrolloffset=(ie4)? oframe.document.body.scrollTop : oframe.pageYOffset;
if(ovauto==1){
if(ie4)iheight=oframe.document.body.clientHeight;
if(ns4)iheight=oframe.innerHeight;
if(ns6)iheight=oframe.outerHeight;
iheight=(eval(iheight))/ 2;
if((oy - scrolloffset)> iheight){
ovpos=35;
}else{
ovpos=36;
}
}
if(ovpos==35){
if(oaboveheight==0){
var divref=(ie4)? oframe.document.all['overDiv'] : over;
oaboveheight=(ns4)? divref.clip.height : divref.offsetHeight;
}
placeY=oy -(oaboveheight + ooffsety);
if(placeY < scrolloffset)placeY=scrolloffset;
}else{
placeY=oy + ooffsety;
}
if(osnapy > 1){
var snapping=placeY % osnapy;
if(oaboveheight > 0 && ovpos==35){
placeY=placeY -(osnapy + snapping);
}else{
placeY=placeY +(osnapy - snapping);
}
if(placeY < scrolloffset)placeY=scrolloffset;
}
}
repositionTo(over, placeX, placeY);
}
function mouseMove(e){
if((ns4)||(ns6)){ox=e.pageX;oy=e.pageY;}
if(ie4){ox=event.x;oy=event.y;}
if(ie5){ox=event.x+oframe.document.body.scrollLeft;oy=event.y+oframe.document.body.scrollTop;}
if(oallowmove==1){
placeLayer();
}
}
function cClick(){
hideObject(over);
oshowingsticky=0;
return false;
}
function compatibleframe(frameid){
if(ns4){
if(typeof frameid.document.overDiv=='undefined')return false;
}else if(ie4){
if(typeof frameid.document.all["overDiv"]=='undefined')return false;
}else if(ns6){
if(frameid.document.getElementById('overDiv')==null)return false;
}
return true;
}
function layerWrite(txt){
txt +="/n";
if(ns4){
var lyr=oframe.document.overDiv.document
lyr.write(txt)
lyr.close()
}else if(ie4){
oframe.document.all["overDiv"].innerHTML=txt
}else if(ns6){
range=oframe.document.createRange();
range.setStartBefore(over);
domfrag=range.createContextualFragment(txt);
while(over.hasChildNodes()){
over.removeChild(over.lastChild);
}
over.appendChild(domfrag);
}
}
function showObject(obj){
if(ns4)obj.visibility="show";
else if(ie4)obj.visibility="visible";
else if(ns6)obj.style.visibility="visible";
}
function hideObject(obj){
if(ns4)obj.visibility="hide";
else if(ie4)obj.visibility="hidden";
else if(ns6)obj.style.visibility="hidden";
if(otimerid > 0)clearTimeout(otimerid);
if(odelayid > 0)clearTimeout(odelayid);
otimerid=0;
odelayid=0;
self.status="";
}
function repositionTo(obj,xL,yL){
if((ns4)||(ie4)){
obj.left=xL;
obj.top=yL;
}else if(ns6){
obj.style.left=xL + "px";
obj.style.top=yL+ "px";
}
}
function opt_FRAME(frm){
oframe=compatibleframe(frm)? frm : ol_frame;
if((ns4)||(ie4 ||(ns6))){
if(ns4)over=oframe.document.overDiv;
if(ie4)over=oframe.overDiv.style;
if(ns6)over=oframe.document.getElementById("overDiv");
}
return 0;
}
function opt_FUNCTION(callme){
otext=callme()
return 0;
}

</script>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>

<form name="sample">
 <p>选择日期: <input type="text" name="T1" size="20"> 
 <!-- ggPosX and ggPosY not set, so popup will autolocate to the right of the graphic -->
 <a href="javascript:show_calendar('sample.T1');" onMouseOver="window.status='Date Picker'; overlib('点击选择当前日期-只显示当月的日历'); return true;" onMouseOut="window.status=''; nd(); return true;">
 <img src="images/time.gif" width=16 height=16 border=0></a>
 </p>
</form>
</body>

</html>

弹出选择日期效果(三)
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效|Linkweb.cn/Js|---弹出选择日期效果(三)</title>
</head>

<body>
<script language="javascript">


// default settings
var fontFace="verdana";
var fontSize=9;

var titleWidth=90;
var titleMode=1;
var dayWidth=12;
var dayDigits=1;

var titleColor="#cccccc";
var daysColor="#cccccc";
var bodyColor="#ffffff";
var dayColor="#ffffff";
var currentDayColor="#333333";
var footColor="#cccccc";
var borderColor="#333333";

var titleFontColor = "#333333";
var daysFontColor = "#333333";
var dayFontColor = "#333333";
var currentDayFontColor = "#ffffff";
var footFontColor = "#333333";

var calFormat = "yyyy/mm/dd";

var weekDay = 0;
// ------

// codes
var calWidth=200, calHeight=200, calOffsetX=-200, calOffsetY=16;
var calWin=null;
var winX=0, winY=0;
var cal="cal";
var cals=new Array();
var currentCal=null;

var yxMonths=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var yxDays=new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
var yxLinks=new Array("[close]", "[clear]");

var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;
var isOpera5=(navigator.appVersion.indexOf("MSIE 5")!=-1 && navigator.userAgent.indexOf("Opera 5")!=-1)?true:false;
var isOpera6=(navigator.appVersion.indexOf("MSIE 5")!=-1 && navigator.userAgent.indexOf("Opera 6")!=-1)?true:false;
var isN6=(navigator.userAgent.indexOf("Gecko")!=-1);
var isN4=(document.layers)?true:false;
var isMac=(navigator.userAgent.indexOf("Mac")!=-1);
var isIE=(document.all && !isOpera && (!isMac || navigator.appVersion.indexOf("MSIE 4")==-1))?true:false;

if (isN4) {
  fontSize+=2;
}

var span2="</span>";

function span1(tag) {
  return "<span class='"+tag+"'>";
}
function spanx(tag, color) {
  return "."+tag+" { font-family:"+fontFace+"; font-size:"+fontSize+"px; color:"+color+"; }/n";
}

function a1(tag) {
  return "<a class='"+tag+"' href=";
}

function ax(tag, color) {
  return "."+tag+" { text-decoration:none; color:"+color+"; }/n";
}

function calOBJ(name, title, field, form) {
  this.name = name;
  this.title = title;
  this.field = field;
  this.formName = form;
  this.form = null
}

function setFont(font, size) {
  if (font != "") {
    fontFace=font;
  }
  if (size > 0) {
    fontSize=size;

    if (isN4) {
      fontSize+=2;
    }
  }
}

function setWidth(tWidth, tMode, dWidth, dDigits) {
  if (tWidth > 0) {
    titleWidth=tWidth;
  }
  if (tMode == 1 || tMode == 2) {
    titleMode=tMode;
  }
  if (dWidth > 0) {
    dayWidth=dWidth;
  }
  if (dDigits > 0) {
    dayDigits=dDigits;
  }
}

function setColor(tColor, dsColor, bColor, dColor, cdColor, fColor, bdColor) {
  if (tColor != "") {
    titleColor=tColor;
  }
  if (dsColor != "") {
    daysColor=dsColor;
  }
  if (bColor != "") {
    bodyColor=bColor;
  }
  if (dColor != "") {
    dayColor=dColor;
  }
  if (cdColor != "") {
    currentDayColor=cdColor;
  }
  if (fColor != "") {
    footColor=fColor;
  }
  if (bdColor != "") {
    borderColor=bdColor;
  }
}

function setFontColor(tColorFont, dsColorFont, dColorFont, cdColorFont, fColorFont) {
  if (tColorFont != "") {
    titleFontColor=tColorFont;
  }
  if (dsColorFont != "") {
    daysFontColor=dsColorFont;
  }
  if (dColorFont != "") {
    dayFontColor=dColorFont;
  }
  if (cdColorFont != "") {
    currentDayFontColor=cdColorFont;
  }
  if (fColorFont != "") {
    footFontColor=fColorFont;
  }
}

function setFormat(format) {
  calFormat = format;
}

function setSize(width, height, ox, oy) {
  if (width > 0) {
    calWidth=width;
  }
  if (height > 0) {
    calHeight=height;
  }

  calOffsetX=ox;
  calOffsetY=oy;
}

function setWeekDay(wDay) {
  if (wDay == 0 || wDay == 1) {
    weekDay = wDay;
  }
}

function setMonthNames(janName, febName, marName, aprName, mayName, junName, julName, augName, sepName, octName, novName, decName) {
  if (janName != "") {
    yxMonths[0] = janName;
  }
  if (febName != "") {
    yxMonths[1] = febName;
  }
  if (marName != "") {
    yxMonths[2] = marName;
  }
  if (aprName != "") {
    yxMonths[3] = aprName;
  }
  if (mayName != "") {
    yxMonths[4] = mayName;
  }
  if (junName != "") {
    yxMonths[5] = junName;
  }
  if (julName != "") {
    yxMonths[6] = julName;
  }
  if (augName != "") {
    yxMonths[7] = augName;
  }
  if (sepName != "") {
    yxMonths[8] = sepName;
  }
  if (octName != "") {
    yxMonths[9] = octName;
  }
  if (novName != "") {
    yxMonths[10] = novName;
  }
  if (decName != "") {
    yxMonths[11] = decName;
  }
}

function setDayNames(sunName, monName, tueName, wedName, thuName, friName, satName) {
  if (sunName != "") {
    yxDays[0] = sunName;
    yxDays[7] = sunName;
  }
  if (monName != "") {
    yxDays[1] = monName;
  }
  if (tueName != "") {
    yxDays[2] = tueName;
  }
  if (wedName != "") {
    yxDays[3] = wedName;
  }
  if (thuName != "") {
    yxDays[4] = thuName;
  }
  if (friName != "") {
    yxDays[5] = friName;
  }
  if (satName != "") {
    yxDays[6] = satName;
  }
}

function setLinkNames(closeLink, clearLink) {
  if (closeLink != "") {
    yxLinks[0] = closeLink;
  }
  if (clearLink != "") {
    yxLinks[1] = clearLink;
  }
}

function addCalendar(name, title, field, form) {
  cals[cals.length] = new calOBJ(name, title, field, form);
}

function findCalendar(name) {
  for (var i = 0; i < cals.length; i++) {
    if (cals[i].name == name) {
      if (cals[i].form == null) {
        if (cals[i].formName == "") {
          if (document.forms[0]) {
            cals[i].form = document.forms[0];
          }
        }
        else if (document.forms[cals[i].formName]) {
          cals[i].form = document.forms[cals[i].formName];
        }
      }

      return cals[i];
    }
  }

  return null;
}

function getDayName(y,m,d) {
  var wd=new Date(y,m,d);
  return yxDays[wd.getDay()].substring(0,3);
}

function getMonthFromName(m3) {
  for (var i = 0; i < yxMonths.length; i++) {
    if (yxMonths[i].toLowerCase().substring(0,3) == m3.toLowerCase()) {
      return i;
    }
  }

  return 0;
}

function getFormat() {
  var calF = calFormat;

  calF = calF.replace(////g, '////');
  calF = calF.replace(////g, '////');
  calF = calF.replace(//[/g, '///[');
  calF = calF.replace(//]/g, '///]');
  calF = calF.replace(//(/g, '///(');
  calF = calF.replace(//)/g, '///)');
  calF = calF.replace(//{/g, '///{');
  calF = calF.replace(//}/g, '///}');
  calF = calF.replace(//</g, '///<');
  calF = calF.replace(//>/g, '///>');
  calF = calF.replace(//|/g, '///|');
  calF = calF.replace(//*/g, '///*');
  calF = calF.replace(//?/g, '///?');
  calF = calF.replace(//+/g, '///+');
  calF = calF.replace(//^/g, '///^');
  calF = calF.replace(//$/g, '///$');

  calF = calF.replace(/dd/i, '//d//d');
  calF = calF.replace(/mm/i, '//d//d');
  calF = calF.replace(/yyyy/i, '//d//d//d//d');
  calF = calF.replace(/day/i, '//w//w//w');
  calF = calF.replace(/mon/i, '//w//w//w');

  return new RegExp(calF);
}

function getDateNumbers(date) {
  var y, m, d;

  var yIdx = calFormat.search(/yyyy/i);
  var mIdx = calFormat.search(/mm/i);
  var m3Idx = calFormat.search(/mon/i);
  var dIdx = calFormat.search(/dd/i);

  y=date.substring(yIdx,yIdx+4)-0;
  if (mIdx != -1) {
    m=date.substring(mIdx,mIdx+2)-1;
  }
  else {
    var m = getMonthFromName(date.substring(m3Idx,m3Idx+3));
  }
  d=date.substring(dIdx,dIdx+2)-0;

  return new Array(y,m,d);
}

function hideCal() {
  calWin.close();
  calWin = null;
  window.status = "";
}

function getLeftIE(x,m) {
  var dx=0;
  if (x.tagName=="TD"){
    dx=x.offsetLeft;
  }
  else if (x.tagName=="TABLE") {
    dx=x.offsetLeft;
    if (m) { dx+=(x.cellPadding!=""?parseInt(x.cellPadding):2); m=false; }
  }
  return dx+(x.parentElement.tagName=="BODY"?0:getLeftIE(x.parentElement,m));
}
function getTopIE(x,m) {
  var dy=0;
  if (x.tagName=="TR"){
    dy=x.offsetTop;
  }
  else if (x.tagName=="TABLE") {
    dy=x.offsetTop;
    if (m) { dy+=(x.cellPadding!=""?parseInt(x.cellPadding):2); m=false; }
  }
  return dy+(x.parentElement.tagName=="BODY"?0:getTopIE(x.parentElement,m));
}

function getLeftN4(l) { return l.pageX; }
function getTopN4(l) { return l.pageY; }

function getLeftN6(l) { return l.offsetLeft; }
function getTopN6(l) { return l.offsetTop; }

function lastDay(d) {
  var yy=d.getFullYear(), mm=d.getMonth();
  for (var i=31; i>=28; i--) {
    var nd=new Date(yy,mm,i);
    if (mm == nd.getMonth()) {
      return i;
    }
  }
}

function firstDay(d) {
  var yy=d.getFullYear(), mm=d.getMonth();
  var fd=new Date(yy,mm,1);
  return fd.getDay();
}

function dayDisplay(i) {
  if (dayDigits == 0) {
    return yxDays[i];
  }
  else {
    return yxDays[i].substring(0,dayDigits);
  }
}

function calTitle(d) {
  var yy=d.getFullYear(), mm=yxMonths[d.getMonth()];
  var s;

  if (titleMode == 2) {
    s="<tr align='center' bgcolor='"+titleColor+"'><td colspan='7'>/n<table cellpadding='0' cellspacing='0' border='0'><tr align='center' valign='middle'><td align='right'>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if(window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(-10)'> &laquo;</a> "+a1("titlea")+"'javascript:if(window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(-1)'>&#8249; </a></b>"+span2+"</td><td width='"+titleWidth+"'><b>"+span1("title")+yy+span2+"</b></td><td align='left'>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(1)'> &#8250;</a> "+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(10)'>&raquo; </a></b>"+span2+"</td></tr><tr align='center' valign='middle'><td align='right'>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.prepMonth) window.opener.prepMonth("+d.getMonth()+")'> &#8249; </a></b>"+span2+"</td><td width='"+titleWidth+"'><b>"+span1("title")+mm+span2+"</b></td><td align='left'>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.nextMonth) window.opener.nextMonth("+d.getMonth()+")'> &#8250; </a></b>"+span2+"</td></tr></table>/n</td></tr><tr align='center' bgcolor='"+daysColor+"'>";
  }
  else {
    s="<tr align='center' bgcolor='"+titleColor+"'><td colspan='7'>/n<table cellpadding='0' cellspacing='0' border='0'><tr align='center' valign='middle'><td>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if(window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(-1)'> &laquo;</a> "+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.prepMonth) window.opener.prepMonth("+d.getMonth()+")'>&#8249; </a></b>"+span2+"</td><td width='"+titleWidth+"'><nobr><b>"+span1("title")+mm+" "+yy+span2+"</b></nobr></td><td>"+span1("title")+"<b>"+a1("titlea")+"'javascript:if (window.opener && !window.opener.closed && window.opener.nextMonth) window.opener.nextMonth("+d.getMonth()+")'> &#8250;</a> "+a1("titlea")+"'javascript:if(window.opener && !window.opener.closed && window.opener.moveYear) window.opener.moveYear(1)'>&raquo; </a></b>"+span2+"</td></tr></table>/n</td></tr><tr align='center' bgcolor='"+daysColor+"'>";
  }

  for (var i=weekDay; i<weekDay+7; i++) {
    s+="<td width='"+dayWidth+"'>"+span1("days")+dayDisplay(i)+span2+"</td>";
  }

  s+="</tr>";

  return s;
}

function calHeader() {
  return "<head>/n<title>"+currentCal.title+"</title>/n<style type='text/css'>/n"+spanx("title",titleFontColor)+spanx("days",daysFontColor)+spanx("foot",footColor)+spanx("day",dayFontColor)+spanx("currentDay",currentDayFontColor)+ax("titlea",titleFontColor)+ax("daya",dayFontColor)+ax("currenta",currentDayFontColor)+ax("foota",footFontColor)+"</style>/n</head>/n<body>/n<table align='center' border='0' bgcolor='"+borderColor+"' cellspacing='0' cellpadding='1'><tr><td>/n<table cellspacing='1' cellpadding='3' border='0'>";
}

function calFooter() {
  return "<tr bgcolor='"+footColor+"'><td colspan='7' align='center'>"+span1("foot")+"<b>"+a1("foota")+"'javascript:if (window.opener && !window.opener.closed && window.opener.hideCal) window.opener.hideCal()'>"+yxLinks[0]+"</a>  "+a1("foota")+"'javascript:if (window.opener && !window.opener.closed && window.opener.clearDate) window.opener.clearDate()'>"+yxLinks[1]+"</a></b>"+span2+"</td></tr></table>/n</td></tr></table>/n</body>";
}

function calBody(d,day) {
  var s="", dayCount=1, fd=firstDay(d), ld=lastDay(d);

  if (weekDay > 0 && fd == 0) {
    fd = 7;
  }

  for (var i=0; i<6; i++) {
    s+="<tr align='center' bgcolor='"+bodyColor+"'>";
    for (var j=weekDay; j<weekDay+7; j++) {
      if (i*7+j<fd || dayCount>ld) {
        s+="<td>"+span1("day")+" "+span2+"</td>";
      }
      else {
        var bgColor=dayColor;
        var fgTag="day";
        var fgTagA="daya";
        if (dayCount==day) {
          bgColor=currentDayColor;
          fgTag="currentDay";
          fgTagA="currenta";
        }
       
        s+="<td bgcolor='"+bgColor+"'>"+span1(fgTag)+a1(fgTagA)+"'javascript: if (window.opener && !window.opener.closed && window.opener.pickDate) window.opener.pickDate("+dayCount+")'>"+(dayCount++)+"</a>"+span2+"</td>";
      }
    }
    s+="</tr>";
  }

  return s;
}

function moveYear(dy) {
  cY+=dy;
  var nd=new Date(cY,cM,1);
  changeCal(nd);
}

function prepMonth(m) {
  cM=m-1;
  if (cM<0) { cM=11; cY--; }
  var nd=new Date(cY,cM,1);
  changeCal(nd);
}

function nextMonth(m) {
  cM=m+1;
  if (cM>11) { cM=0; cY++;}
  var nd=new Date(cY,cM,1);
  changeCal(nd);
}

function changeCal(d) {
  var dd = 0;

  if (currentCal != null) {
    var calRE = getFormat();

    if (currentCal.form[currentCal.field].value!="" && calRE.test(currentCal.form[currentCal.field].value)) {
      var cd = getDateNumbers(currentCal.form[currentCal.field].value);
      if (cd[0] == d.getFullYear() && cd[1] == d.getMonth()) {
        dd=cd[2];
      }
    }
    else {
      var cd = new Date();
      if (cd.getFullYear() == d.getFullYear() && cd.getMonth() == d.getMonth()) {
        dd=cd.getDate();
      }
    }
  }

  var calendar=calHeader()+calTitle(d)+calBody(d,dd)+calFooter();

  calWin.document.open();
  calWin.document.write(calendar);
  calWin.document.close();
}

function markClick(e) {
  if (isIE || isOpera6) {
    winX=event.screenX;
    winY=event.screenY;
  }
  else if (isN4 || isN6) {
    winX=e.screenX;
    winY=e.screenY;

    document.routeEvent(e);
  }

  return true;
}

function showCal(name) {
  var lastCal=currentCal;
  var d=new Date(), hasCal=false;

  currentCal = findCalendar(name);

  if (currentCal != null && currentCal.form != null && currentCal.form[currentCal.field]) {
    var calRE = getFormat();

    if (currentCal.form[currentCal.field].value!="" && calRE.test(currentCal.form[currentCal.field].value)) {
      var cd = getDateNumbers(currentCal.form[currentCal.field].value);
      d=new Date(cd[0],cd[1],cd[2]);

      cY=cd[0];
      cM=cd[1];
      dd=cd[2];
    }
    else {
      cY=d.getFullYear();
      cM=d.getMonth();
      dd=d.getDate();
    }

    var calendar=calHeader()+calTitle(d)+calBody(d,dd)+calFooter();

    if (calWin != null && !calWin.closed) {
      hasCal=true;
      calWin.moveTo(winX+calOffsetX,winY+calOffsetY);
    }

    if (!hasCal) {
      if (isIE || isOpera6) {
        calWin=window.open("","cal","toolbar=0,width="+calWidth+",height="+calHeight+",left="+(winX+calOffsetX)+",top="+(winY+calOffsetY));
      }
      else {
        calWin=window.open("","cal","toolbar=0,width="+calWidth+",height="+calHeight+",screenx="+(winX+calOffsetX)+",screeny="+(winY+calOffsetY));
      }
    }

    calWin.document.open();
    calWin.document.write(calendar);
    calWin.document.close();

    calWin.focus();
  }
  else {
    if (currentCal == null) {
      window.status = "Calendar ["+name+"] not found.";
    }
    else if (!currentCal.form) {
      window.status = "Form ["+currentCal.formName+"] not found.";
    }
    else if (!currentCal.form[currentCal.field]) {
      window.status = "Form Field ["+currentCal.formName+"."+currentCal.field+"] not found.";
    }

    if (lastCal != null) {
      currentCal = lastCal;
    }
  }
}

function get2Digits(n) {
  return ((n<10)?"0":"")+n;
}

function clearDate() {
  currentCal.form[currentCal.field].value="";
  hideCal();
}

function pickDate(d) {
  hideCal();
  window.focus();

  var date=calFormat;
  date = date.replace(/yyyy/i, cY);
  date = date.replace(/mm/i, get2Digits(cM+1));
  date = date.replace(/MON/, yxMonths[cM].substring(0,3).toUpperCase());
  date = date.replace(/Mon/i, yxMonths[cM].substring(0,3));
  date = date.replace(/dd/i, get2Digits(d));
  date = date.replace(/DAY/, getDayName(cY,cM,d).toUpperCase());
  date = date.replace(/day/i, getDayName(cY,cM,d));

  currentCal.form[currentCal.field].value=date;
  // IE5/Mac needs focus to show the value, weird.
  currentCal.form[currentCal.field].focus();
}
// ------

// user functions
function checkDate(name) {
  var thisCal = findCalendar(name);

  if (thisCal != null && thisCal.form != null && thisCal.form[thisCal.field]) {
    var calRE = getFormat();

    if (calRE.test(thisCal.form[thisCal.field].value)) {
      return 0;
    }
    else {
      return 1;
    }
  }
  else {
    return 2;
  }
}

function getCurrentDate() {
  var date=calFormat, d = new Date();
  date = date.replace(/yyyy/i, d.getFullYear());
  date = date.replace(/mm/i, get2Digits(d.getMonth()+1));
  date = date.replace(/dd/i, get2Digits(d.getDate()));

  return date;
}

function compareDates(date1, date2) {
  var calRE = getFormat();
  var d1, d2;

  if (calRE.test(date1)) {
    d1 = getNumbers(date1);
  }
  else {
    d1 = getNumbers(getCurrentDate());
  }

  if (calRE.test(date2)) {
    d2 = getNumbers(date2);
  }
  else {
    d2 = getNumbers(getCurrentDate());
  }

  var dStr1 = d1[0] + "" + d1[1] + "" + d1[2];
  var dStr2 = d2[0] + "" + d2[1] + "" + d2[2];

  if (dStr1 == dStr2) {
    return 0;
  }
  else if (dStr1 > dStr2) {
    return 1;
  }
  else {
    return -1;
  }
}

function getNumbers(date) {
  var calRE = getFormat();
  var y, m, d;

  if (calRE.test(date)) {
    var yIdx = calFormat.search(/yyyy/i);
    var mIdx = calFormat.search(/mm/i);
    var m3Idx = calFormat.search(/mon/i);
    var dIdx = calFormat.search(/dd/i);

    y=date.substring(yIdx,yIdx+4);
    if (mIdx != -1) {
      m=date.substring(mIdx,mIdx+2);
    }
    else {
      var mm=getMonthFromName(date.substring(m3Idx,m3Idx+3))+1;
      m=(mm<10)?("0"+mm):(""+mm);
    }
    d=date.substring(dIdx,dIdx+2);

    return new Array(y,m,d);
  }
  else {
    return new Array("", "", "");
  }
}
// ------

if (isN4 || isN6) {
  document.captureEvents(Event.CLICK);
}
document.onclick=markClick;

</script>
<script language="javascript">

//Define calendar(s): addCalendar ("Unique Calendar Name", "Window title", "Form element's name", Form name")
addCalendar("Calendar1", "Select Date", "firstinput", "sampleform");
addCalendar("Calendar2", "Select Date", "secondinput", "sampleform");

// default settings for English
// Uncomment desired lines and modify its values
// setFont("verdana", 9);
 setWidth(90, 1, 15, 1);
// setColor("#cccccc", "#cccccc", "#ffffff", "#ffffff", "#333333", "#cccccc", "#333333");
// setFontColor("#333333", "#333333", "#333333", "#ffffff", "#333333");
// setFormat("yyyy/mm/dd");
// setSize(200, 200, -200, 16);

// setWeekDay(0);
// setMonthNames("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
// setDayNames("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
// setLinkNames("[Close]", "[Clear]");
</script>
<form name="sampleform">
<input type="text" name="firstinput" size=20> <small><a href="javascript:showCal('Calendar1')">选择日期一</a></small>
<p><input type="text" name="secondinput" size=20> <small><a href="javascript:showCal('Calendar2')">选择日期二</a></small>
</form>
</body>

</html>

jsp弹出选择日期效果

<HTML>
<HEAD>
<TITLE>网页特效|Linkweb.cn/Js|---弹出选择日期效果(一)</TITLE>
<SCRIPT LANGUAGE=javascript>
function hide(){
showCalendar.style.display="none"
}
x=window.setTimeout ("hide()",1)
</SCRIPT>
<SCRIPT  LANGUAGE=vbscript>
''点击后显示日期控件
function button1_onclick()
showCalendar.style.display="inline"
if text1.value <> "" then
Calendar1.Value=text1.value
end if
end function
function Calendar1_Click()
''当选择日期后,把值显示到文本框
''以下是选择时间的格式
''text1.value =formatdatetime(Calendar1.Value,0)
text1.value =formatdatetime(Calendar1.Value,1)
''text1.value =formatdatetime(Calendar1.Value,2)
showCalendar.style.display="none"
end function
</SCRIPT>
<SCRIPT LANGUAGE=vbscript FOR=Calendar1 EVENT=Click>
Calendar1_Click()
</SCRIPT>
</HEAD>
<BODY>  
<br>
<INPUT id=text1 readonly name=text1 style="HEIGHT: 22px; WIDTH: 177px"><INPUT type="button" value="选择时间" id=button1 name=button1  onclick=" button1_onclick()">
<P>
<div id=showCalendar >
<OBJECT classid=clsid:8E27C92B-1264-101C-8A2F-040224009C02 id=Calendar1><PARAM NAME="_Version" VALUE="524288"><PARAM NAME="_ExtentX" VALUE="7620"><PARAM NAME="_ExtentY" VALUE="5080"><PARAM NAME="_StockProps" VALUE="1"><PARAM NAME="BackColor" VALUE="-2147483633"><PARAM NAME="Year" VALUE="2002"><PARAM NAME="Month" VALUE="4"><PARAM NAME="Day" VALUE="2"><PARAM NAME="DayLength" VALUE="0"><PARAM NAME="MonthLength" VALUE="0"><PARAM NAME="DayFontColor" VALUE="0"><PARAM NAME="FirstDay" VALUE="1"><PARAM NAME="GridCellEffect" VALUE="1"><PARAM NAME="GridFontColor" VALUE="10485760"><PARAM NAME="GridLinesColor" VALUE="-2147483632"><PARAM NAME="ShowDateSelectors" VALUE="-1"><PARAM NAME="ShowDays" VALUE="-1"><PARAM NAME="ShowHorizontalGrid" VALUE="-1"><PARAM NAME="ShowTitle" VALUE="-1"><PARAM NAME="ShowVerticalGrid" VALUE="-1"><PARAM NAME="TitleFontColor" VALUE="10485760"><PARAM NAME="ValueIsNull" VALUE="0"></OBJECT>
</div>
</BODY>
</HTML>
很不错的一款日期输入控件,可以输入当前的时间
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网页特效代码|JsCode.CN|---又一款日期输入控件,可以输入当前的时间</title>
</head>
<body>
<form name="form1" method="post" action="">
  <p>
    <input type="text" name="textfield"  onFocus="CalendarWebControl.show(this,true,this.value);">
    日期时间输入</p>
  <p>
    <input type="text" name="textfield2" onFocus="CalendarWebControl.show(this,false,this.value);">
日期输入</p>
</form>
<script language="javascript">
function atCalendarControl(){
  var calendar=this;
  this.calendarPad=null;
  this.prevMonth=null;
  this.nextMonth=null;
  this.prevYear=null;
  this.nextYear=null;
  this.goToday=null;
  this.calendarClose=null;
  this.calendarAbout=null;
  this.head=null;
  this.body=null;
  this.today=[];
  this.currentDate=[];
  this.sltDate;
  this.target;
  this.source;
  /************** 加入日历底板及阴影 *********************/
  this.addCalendarPad=function(){
   document.write("<div id='divCalendarpad' style='position:absolute;top:100;left:0;width:255;height:187;display:none;'>");
   document.write("<iframe frameborder=0 height=189 width=250></iframe>");
   document.write("<div style='position:absolute;top:2;left:2;width:250;height:187;background-color:#336699;'></div>");
   document.write("</div>");
   calendar.calendarPad=document.all.divCalendarpad;
  }
  /************** 加入日历面板 *********************/
  this.addCalendarBoard=function(){
   var BOARD=this;
   var divBoard=document.createElement("div");
   calendar.calendarPad.insertAdjacentElement("beforeEnd",divBoard);
   divBoard.style.cssText="position:absolute;top:0;left:0;width:250;height:187;border:0 outset;background-color:buttonface;";
   var tbBoard=document.createElement("table");
   divBoard.insertAdjacentElement("beforeEnd",tbBoard);
   tbBoard.style.cssText="position:absolute;top:2;left:2;width:248;height:10;font-size:9pt;";
   tbBoard.cellPadding=0;
   tbBoard.cellSpacing=1;
  /************** 设置各功能按钮的功能 *********************/
   /*********** Calendar About Button ***************/
   trRow = tbBoard.insertRow(0);
   calendar.calendarAbout=calendar.insertTbCell(trRow,0,"-","center");
   calendar.calendarAbout.title="帮助 快捷键:H";
   calendar.calendarAbout.onclick=function(){calendar.about();}
   /*********** Calendar Head ***************/
   tbCell=trRow.insertCell(1);
   tbCell.colSpan=5;
   tbCell.bgColor="#99CCFF";
   tbCell.align="center";
   tbCell.style.cssText = "cursor:default";
   calendar.head=tbCell;
   /*********** Calendar Close Button ***************/
   tbCell=trRow.insertCell(2);
   calendar.calendarClose = calendar.insertTbCell(trRow,2,"x","center");
   calendar.calendarClose.title="关闭 快捷键:ESC或X";
   calendar.calendarClose.onclick=function(){calendar.hide();}
   /*********** Calendar PrevYear Button ***************/
   trRow = tbBoard.insertRow(1);
   calendar.prevYear = calendar.insertTbCell(trRow,0,"<<","center");
   calendar.prevYear.title="上一年 快捷键:↑";
   calendar.prevYear.onmousedown=function(){
    calendar.currentDate[0]--;
    calendar.show(calendar.target,calendar.returnTime,calendar.currentDate[0]+"-"+calendar.formatTime(calendar.currentDate[1])+"-"+calendar.formatTime(calendar.currentDate[2]),calendar.source);
   }
   /*********** Calendar PrevMonth Button ***************/
   calendar.prevMonth = calendar.insertTbCell(trRow,1,"<","center");
   calendar.prevMonth.title="上一月 快捷键:←";
   calendar.prevMonth.onmousedown=function(){
    calendar.currentDate[1]--;
    if(calendar.currentDate[1]==0){
     calendar.currentDate[1]=12;
     calendar.currentDate[0]--;
    }
    calendar.show(calendar.target,calendar.returnTime,calendar.currentDate[0]+"-"+calendar.formatTime(calendar.currentDate[1])+"-"+calendar.formatTime(calendar.currentDate[2]),calendar.source);
   }
   /*********** Calendar Today Button ***************/
   calendar.goToday = calendar.insertTbCell(trRow,2,"今天","center",3);
   calendar.goToday.title="选择今天 快捷键:T";
   calendar.goToday.onclick=function(){
  if(calendar.returnTime) 
     calendar.sltDate=calendar.today[0]+"-"+calendar.formatTime(calendar.today[1])+"-"+calendar.formatTime(calendar.today[2])+" "+calendar.formatTime(calendar.today[3])+":"+calendar.formatTime(calendar.today[4])
  else
     calendar.sltDate=calendar.today[0]+"-"+calendar.formatTime(calendar.today[1])+"-"+calendar.formatTime(calendar.today[2]);
    calendar.target.value=calendar.sltDate;
    calendar.hide();
    //calendar.show(calendar.target,calendar.today[0]+"-"+calendar.today[1]+"-"+calendar.today[2],calendar.source);
   }
   /*********** Calendar NextMonth Button ***************/
   calendar.nextMonth = calendar.insertTbCell(trRow,3,"&gt;","center");
   calendar.nextMonth.title="下一月 快捷键:→";
   calendar.nextMonth.onmousedown=function(){
    calendar.currentDate[1]++;
    if(calendar.currentDate[1]==13){
     calendar.currentDate[1]=1;
     calendar.currentDate[0]++;
    }
    calendar.show(calendar.target,calendar.returnTime,calendar.currentDate[0]+"-"+calendar.formatTime(calendar.currentDate[1])+"-"+calendar.formatTime(calendar.currentDate[2]),calendar.source);
   }
   /*********** Calendar NextYear Button ***************/
   calendar.nextYear = calendar.insertTbCell(trRow,4,"&gt;&gt;","center");
   calendar.nextYear.title="下一年 快捷键:↓";
   calendar.nextYear.onmousedown=function(){
    calendar.currentDate[0]++;
    calendar.show(calendar.target,calendar.returnTime,calendar.currentDate[0]+"-"+calendar.formatTime(calendar.currentDate[1])+"-"+calendar.formatTime(calendar.currentDate[2]),calendar.source);
   }
   trRow = tbBoard.insertRow(2);
   var cnDateName = new Array("日","一","二","三","四","五","六");
   for (var i = 0; i < 7; i++) {
    tbCell=trRow.insertCell(i)
    tbCell.innerText=cnDateName[i];
    tbCell.align="center";
    tbCell.width=35;
    tbCell.style.cssText="cursor:default;border:1 solid #99CCCC;background-color:#99CCCC;";
   }
   /*********** Calendar Body ***************/
   trRow = tbBoard.insertRow(3);
   tbCell=trRow.insertCell(0);
   tbCell.colSpan=7;
   tbCell.height=97;
   tbCell.vAlign="top";
   tbCell.bgColor="#F0F0F0";
  
   var tbBody=document.createElement("table");
   tbCell.insertAdjacentElement("beforeEnd",tbBody);
   tbBody.style.cssText="position:relative;top:0;left:0;width:245;height:103;font-size:9pt;"
   tbBody.cellPadding=0;
   tbBody.cellSpacing=1;
   calendar.body=tbBody;
 
   /*********** Time Body ***************/
   trRow = tbBoard.insertRow(4);
   tbCell=trRow.insertCell(0);
   calendar.prevHours = calendar.insertTbCell(trRow,0,"-","center");
   calendar.prevHours.title="小时调整 快捷键:Home";
   calendar.prevHours.onmousedown=function(){
  calendar.currentDate[3]--;
  if(calendar.currentDate[3]==-1) calendar.currentDate[3]=23;
  calendar.bottom.innerText=calendar.formatTime(calendar.currentDate[3])+":"+calendar.formatTime(calendar.currentDate[4]);
 }
   tbCell=trRow.insertCell(1);
   calendar.nextHours = calendar.insertTbCell(trRow,1,"+","center");
   calendar.nextHours.title="小时调整 快捷键:End";
   calendar.nextHours.onmousedown=function(){
  calendar.currentDate[3]++;
  if(calendar.currentDate[3]==24) calendar.currentDate[3]=0;
  calendar.bottom.innerText=calendar.formatTime(calendar.currentDate[3])+":"+calendar.formatTime(calendar.currentDate[4]);
 }
   tbCell=trRow.insertCell(2);
   tbCell.colSpan=3;
   tbCell.bgColor="#99CCFF";
   tbCell.align="center";
   tbCell.style.cssText = "cursor:default";
   calendar.bottom=tbCell;
   tbCell=trRow.insertCell(3);
   calendar.prevMinutes = calendar.insertTbCell(trRow,3,"-","center");
   calendar.prevMinutes.title="分钟调整 快捷键:PageUp";
   calendar.prevMinutes.onmousedown=function(){
  calendar.currentDate[4]--;
  if(calendar.currentDate[4]==-1) calendar.currentDate[4]=59;
  calendar.bottom.innerText=calendar.formatTime(calendar.currentDate[3])+":"+calendar.formatTime(calendar.currentDate[4]);
 }
   tbCell=trRow.insertCell(4);
   calendar.nextMinutes = calendar.insertTbCell(trRow,4,"+","center");
   calendar.nextMinutes.title="分钟调整 快捷键:PageDown";
   calendar.nextMinutes.onmousedown=function(){
  calendar.currentDate[4]++;
  if(calendar.currentDate[4]==60) calendar.currentDate[4]=0;
  calendar.bottom.innerText=calendar.formatTime(calendar.currentDate[3])+":"+calendar.formatTime(calendar.currentDate[4]);
 }
}
 
/************** 加入功能按钮公共样式 *********************/
  this.insertTbCell=function(trRow,cellIndex,TXT,trAlign,tbColSpan){
   var tbCell=trRow.insertCell(cellIndex);
   if(tbColSpan!=undefined) tbCell.colSpan=tbColSpan;
   var btnCell=document.createElement("button");
   tbCell.insertAdjacentElement("beforeEnd",btnCell);
   btnCell.value=TXT;
   btnCell.style.cssText="width:100%;border:1 outset;background-color:buttonface;";
   btnCell.onmouseover=function(){
   btnCell.style.cssText="width:100%;border:1 outset;background-color:#F0F0F0;";
   }
   btnCell.onmouseout=function(){
    btnCell.style.cssText="width:100%;border:1 outset;background-color:buttonface;";
   }
  // btnCell.onmousedown=function(){
  //  btnCell.style.cssText="width:100%;border:1 inset;background-color:#F0F0F0;";
  // }
   btnCell.onmouseup=function(){
    btnCell.style.cssText="width:100%;border:1 outset;background-color:#F0F0F0;";
   }
   btnCell.onclick=function(){
    btnCell.blur();
   }
   return btnCell;
  }
 
  this.setDefaultDate=function(){
   var dftDate=new Date();
   calendar.today[0]=dftDate.getYear();
   calendar.today[1]=dftDate.getMonth()+1;
   calendar.today[2]=dftDate.getDate();
   calendar.today[3]=dftDate.getHours();
   calendar.today[4]=dftDate.getMinutes();
  }
  /****************** Show Calendar *********************/
  this.show=function(targetObject,returnTime,defaultDate,sourceObject){
   if(targetObject==undefined) {
    alert("未设置目标对象. /n方法: ATCALENDAR.show(obj 目标对象,boolean 是否返回时间,string 默认日期,obj 点击对象);/n/n目标对象:接受日期返回值的对象./n默认日期:格式为/"yyyy-mm-dd/",缺省为当前日期./n点击对象:点击这个对象弹出calendar,默认为目标对象./n");
    return false;
   }
   else calendar.target=targetObject;
  
   if(sourceObject==undefined) calendar.source=calendar.target;
   else calendar.source=sourceObject;
   if(returnTime) calendar.returnTime=true;
   else calendar.returnTime=false;
   var firstDay;
   var Cells=new Array();
   if((defaultDate==undefined) || (defaultDate=="")){
    var theDate=new Array();
    calendar.head.innerText = calendar.today[0]+"-"+calendar.formatTime(calendar.today[1])+"-"+calendar.formatTime(calendar.today[2]);
    calendar.bottom.innerText = calendar.formatTime(calendar.today[3])+":"+calendar.formatTime(calendar.today[4]);
 
    theDate[0]=calendar.today[0]; theDate[1]=calendar.today[1]; theDate[2]=calendar.today[2];
 theDate[3]=calendar.today[3]; theDate[4]=calendar.today[4];
   }
   else{
    var Datereg=/^/d{4}-/d{1,2}-/d{2}$/
    var DateTimereg=/^(/d{1,4})-(/d{1,2})-(/d{1,2}) (/d{1,2}):(/d{1,2})$/
    if((!defaultDate.match(Datereg)) && (!defaultDate.match(DateTimereg))){
     alert("默认日期(时间)的格式不正确!/t/n/n默认可接受格式为:/n1、yyyy-mm-dd /n2、yyyy-mm-dd hh:mm/n3、(空)");
  calendar.setDefaultDate();
     return;
    }
 
 if(defaultDate.match(Datereg)) defaultDate=defaultDate+" "+calendar.today[3]+":"+calendar.today[4];
 var strDateTime=defaultDate.match(DateTimereg);
 var theDate=new Array(4)
 theDate[0]=strDateTime[1];
 theDate[1]=strDateTime[2];
 theDate[2]=strDateTime[3];
 theDate[3]=strDateTime[4];
 theDate[4]=strDateTime[5];
    calendar.head.innerText = theDate[0]+"-"+calendar.formatTime(theDate[1])+"-"+calendar.formatTime(theDate[2]);
    calendar.bottom.innerText = calendar.formatTime(theDate[3])+":"+calendar.formatTime(theDate[4]);
 }
   calendar.currentDate[0]=theDate[0];
   calendar.currentDate[1]=theDate[1];
   calendar.currentDate[2]=theDate[2];
   calendar.currentDate[3]=theDate[3];
   calendar.currentDate[4]=theDate[4];
  
   theFirstDay=calendar.getFirstDay(theDate[0],theDate[1]);
   theMonthLen=theFirstDay+calendar.getMonthLen(theDate[0],theDate[1]);
   //calendar.setEventKey();
   calendar.calendarPad.style.display="";
   var theRows = Math.ceil((theMonthLen)/7);
   //清除旧的日历;
   while (calendar.body.rows.length > 0) {
    calendar.body.deleteRow(0)
   }
   //建立新的日历;
   var n=0;day=0;
   for(i=0;i<theRows;i++){
    theRow=calendar.body.insertRow(i);
    for(j=0;j<7;j++){
     n++;
     if(n>theFirstDay && n<=theMonthLen){
      day=n-theFirstDay;
      calendar.insertBodyCell(theRow,j,day);
     }
     else{
      var theCell=theRow.insertCell(j);
      theCell.style.cssText="background-color:#F0F0F0;cursor:default;";
     }
    }
   }
   //****************调整日历位置**************//
   var offsetPos=calendar.getAbsolutePos(calendar.source);//计算对象的位置;
   if((document.body.offsetHeight-(offsetPos.y+calendar.source.offsetHeight-document.body.scrollTop))<calendar.calendarPad.style.pixelHeight){
    var calTop=offsetPos.y-calendar.calendarPad.style.pixelHeight;
   }
   else{
    var calTop=offsetPos.y+calendar.source.offsetHeight;
   }
   if((document.body.offsetWidth-(offsetPos.x+calendar.source.offsetWidth-document.body.scrollLeft))>calendar.calendarPad.style.pixelWidth){
    var calLeft=offsetPos.x;
   }
   else{
    var calLeft=calendar.source.offsetLeft+calendar.source.offsetWidth;
   }
   //alert(offsetPos.x);
   calendar.calendarPad.style.pixelLeft=calLeft;
   calendar.calendarPad.style.pixelTop=calTop;
  }
  /****************** 计算对象的位置 *************************/
  this.getAbsolutePos = function(el) {
   var r = { x: el.offsetLeft, y: el.offsetTop };
   if (el.offsetParent) {
    var tmp = calendar.getAbsolutePos(el.offsetParent);
    r.x += tmp.x;
    r.y += tmp.y;
   }
   return r;
  };
  //************* 插入日期单元格 **************/
  this.insertBodyCell=function(theRow,j,day,targetObject){
   var theCell=theRow.insertCell(j);
   if(j==0) var theBgColor="#FF9999";
   else var theBgColor="#FFFFFF";
   if(day==calendar.currentDate[2]) var theBgColor="#CCCCCC";
   if(day==calendar.today[2]) var theBgColor="#99FFCC";
   theCell.bgColor=theBgColor;
   theCell.innerText=day;
   theCell.align="center";
   theCell.width=35;
   theCell.style.cssText="border:1 solid #CCCCCC;cursor:hand;";
   theCell.onmouseover=function(){
    theCell.bgColor="#FFFFCC";
    theCell.style.cssText="border:1 outset;cursor:hand;";
   }
   theCell.onmouseout=function(){
    theCell.bgColor=theBgColor;
    theCell.style.cssText="border:1 solid #CCCCCC;cursor:hand;";
   }
   theCell.onmousedown=function(){
    theCell.bgColor="#FFFFCC";
    theCell.style.cssText="border:1 inset;cursor:hand;";
   }
   theCell.onclick=function(){
  if(calendar.returnTime) 
     calendar.sltDate=calendar.currentDate[0]+"-"+calendar.formatTime(calendar.currentDate[1])+"-"+calendar.formatTime(day)+" "+calendar.formatTime(calendar.currentDate[3])+":"+calendar.formatTime(calendar.currentDate[4])
  else
     calendar.sltDate=calendar.currentDate[0]+"-"+calendar.formatTime(calendar.currentDate[1])+"-"+calendar.formatTime(day);
    calendar.target.value=calendar.sltDate;
    calendar.hide();
   }
  }
  /************** 取得月份的第一天为星期几 *********************/
  this.getFirstDay=function(theYear, theMonth){
   var firstDate = new Date(theYear,theMonth-1,1);
   return firstDate.getDay();
  }
  /************** 取得月份共有几天 *********************/
  this.getMonthLen=function(theYear, theMonth) {
   theMonth--;
   var oneDay = 1000 * 60 * 60 * 24;
   var thisMonth = new Date(theYear, theMonth, 1);
   var nextMonth = new Date(theYear, theMonth + 1, 1);
   var len = Math.ceil((nextMonth.getTime() - thisMonth.getTime())/oneDay);
   return len;
  }
  /************** 隐藏日历 *********************/
  this.hide=function(){
   //calendar.clearEventKey();
   calendar.calendarPad.style.display="none";
  
  }
  /************** 从这里开始 *********************/
  this.setup=function(defaultDate){
   calendar.addCalendarPad();
   calendar.addCalendarBoard();
   calendar.setDefaultDate();
  }
  /************** 格式化时间 *********************/
 this.formatTime = function(str) {
  str = ("00"+str);
  return str.substr(str.length-2);
 }
/************** 关于AgetimeCalendar *********************/
  this.about=function(){
   var strAbout = "/nWeb 日历选择输入控件操作说明:/n/n";
   strAbout+="-/t: 关于/n";
   strAbout+="x/t: 隐藏/n";
   strAbout+="<</t: 上一年/n";
   strAbout+="</t: 上一月/n";
   strAbout+="今日/t: 返回当天日期/n";
   strAbout+=">/t: 下一月/n";
   strAbout+="<</t: 下一年/n";
   strAbout+="/nWeb日历选择输入控件/tVer:v1.0/t/nDesigned By:wxb /t/t2004.11.22/t/n";
   alert(strAbout);
  }
 
document.onkeydown=function(){
 if(calendar.calendarPad.style.display=="none"){
  window.event.returnValue= true;
  return true ;
 }
 switch(window.event.keyCode){
  case 27 : calendar.hide(); break; //ESC
  case 37 : calendar.prevMonth.onmousedown(); break;//←
  case 38 : calendar.prevYear.onmousedown();break; //↑
  case 39 : calendar.nextMonth.onmousedown(); break;//→
  case 40 : calendar.nextYear.onmousedown(); break;//↓
  case 84 : calendar.goToday.onclick(); break;//T
  case 88 : calendar.hide(); break;   //X
  case 72 : calendar.about(); break;   //H 
  case 36 : calendar.prevHours.onmousedown(); break;//Home
  case 35 : calendar.nextHours.onmousedown(); break;//End
  case 33 : calendar.prevMinutes.onmousedown();break; //PageUp
  case 34 : calendar.nextMinutes.onmousedown(); break;//PageDown
  }
  window.event.keyCode = 0;
  window.event.returnValue= false;
  }
  calendar.setup();
 }
 
var CalendarWebControl = new atCalendarControl();
</script>
</body>
</html>
实现美观且功能强大的JavaScript日期范围选择器 本文还有配套的精品资源,点击获取 简介:JavaScript中的日期时间处理在网页交互和用户界面设计中经常需要。"很漂亮的日期带范围js"可能是一个具有美感和丰富功能的日期选择器,它允许用户选择一个时间范围。这类功能对于构建事件日历、预订系统等应用至关重要。本工具可能会包括日期和时间选择器、日期时间对象处理、范围验证、事件监听、样式设计、国际化支持、可扩展性与模块化以及兼容... 阅读详情

相关推荐

实现高效酒店预订系统的日期时间选择器

jQuery是一个快速、小巧且功能丰富的JavaScript库,它简化了HTML文档遍历、事件处理、动画以及Ajax交互等操作,极大地简化了JavaScript开发。自2006年问世以来,jQuery便迅速成为Web开发领域中不可或缺的工具之一,被广泛应用于各个项目中。daterangepicker.js是一个功能强大的JavaScript插件,用于在Web应用中添加一个直观且可配置的日期范围选择器。它允许用户选择一个日期范围,并将这个范围以特定格式反馈给用户或用于进一步的处理。

weixin_42511373的博客 658

实现一个简单的JavaScript日期选择器

通过实现一个简单的日期选择器,我们学习了如何在Web开发中使用JavaScript的Date对象处理日期。在这个过程中,我们不仅掌握了基础的DOM操作和事件监听,还体验了从无到有创建用户界面的乐趣。这个过程也让我意识到,有时候过于依赖第三方库可能会限制我们的思维和创新能力。自己动手实现一些基础功能不仅可以提高我们的技术水平,还可以培养我们解决问题的能力。在未来的Web开发中,我会更加注重这种能力的培养,以便在面对各种挑战时能够更加从容地应对。

geng1025的博客 3943

有史以来最小的GIF/png/jpg/jpeg

昨天我对图像进行了 base64 编码,这样我就可以将它发送到 CouchDB 以测试我正在为客户编写的一些代码。它让我想起了我之前在远程服务器上设置 cookie 时所做的事情。基本上,一个小的 PHP 脚本被放在远程服务器上,它接受几个 GET 参数并根据它们的值设置一些 cookie。然后脚本输出一个 1x1 的透明 GIF。本地服务器上的 PHP 脚本生成了一个 IMG 标签,该标签链接到该图像并根据本地服务器上的 COOKIES 设置参数。

凌凌1301的博客 1423

html中如何插入日期选择器,javascript - 如何在HTML5中添加带有选定日期的HH:MM格式的时间选择器? - 堆栈内存溢出...

我到处搜索,但对答案不满意。 最后,我在这里发布以获得答案。我有两个datepicker和time picker textbox ,其中显示12:00格式的AM和PM。在这里,我想计算总计time ,其中包括天数和给定时间。 我想添加这些时间并将其显示在另一个文本框中。 我需要HH:MM格式。 我不需要秒,因为我的time picker textbox仅显示HH:MM ,对我来说足够了。我...

weixin_36354965的博客 438

ASTRA Toolbox学习笔记-Python

ASTRA Toolbox 是一个用于处理 X 射线相干散射和 X 射线传输成像的开源算法工具箱。本文档概述了该工具箱的基本概念。

hou9021的博客 8274

Windows服务器SSL漏洞修复实战:从CVE-2016-2183到RC4的完整配置指南

本文提供了一份针对Windows服务器的SSL/TLS安全漏洞(如CVE-2016-2183和RC4相关漏洞)的实战修复指南。文章深入解析了漏洞原理,并详细演示了如何通过组策略编辑器、注册表和PowerShell命令,禁用不安全的密码套件(如3DES和RC4),配置安全的TLS协议版本,以加固服务器安全。同时,提供了配置验证、自动化管理和故障排除的完整流程,帮助运维人员有效应对安全扫描与合规要求。

yy01234的博客 1090

日期-日历-选择器实现(图文并茂)

日期-日历-选择器实现(图文并茂)

SoulNone的博客 2050

【SAP-MDG】工作流任务配置实战:从基础配置到代理分配详解

本文详细解析了SAP MDG工作流任务配置的全流程,从基础配置到代理分配的关键操作。通过实战案例和最佳实践,帮助用户掌握Configure Workflow Tasks的核心技巧,包括环境检查、代理分配、SWDD事务码使用及常见问题排查,提升主数据管理效率。

weixin_33738555的博客 252

使用JavaScript实现一个复杂功能:日期范围选择器

日期范围选择器是一个常见的Web应用功能,它允许用户选择一个日期范围。在本篇文章中,我们将使用JavaScript来实现这个功能。

geng1025的博客 1245

别再死记硬背了!用‘瞬时极性法’5分钟搞定三极管反馈电路类型判断

本文介绍了使用‘瞬时极性法’快速判断三极管反馈电路类型的高效技巧。通过假设输入信号变化并追踪传递路径,该方法能准确区分正负反馈、电压电流反馈、串联并联反馈及交直流反馈,避免传统死记硬背的弊端,显著提升电路分析效率。

weixin_42524708的博客 191

(五)C++自制植物大战僵尸游戏LoadingScene的实现讲解

游戏启动后就会立即切换到游戏加载场景中。只有游戏资源文件加载完成后,才能进入游戏。Loadingscene类继承Cocos2d-x中的Scene父类,表明Loadingscene是一个场景类。切换到LoadingScene场景中,首先会创建该场景,会调用函数,在该函数中调用自己定义的方法实现指定功能。代码文件的位置如下图所示。

尔灵尔亿的博客 2012

js原生写时间日期选择

这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 欢迎使用Ma...

weixin_43972857的博客 1292

python爬取银行年报2

python爬取公司年报(巨潮资讯网)

bboysteed的博客 4737

Vue Datetime 项目推荐

Vue Datetime 是一个移动友好的日期时间选择器组件,专为 Vue.js 框架设计。该项目的主要编程语言是 JavaScript 和 Vue.js。它提供了一个灵活且易于集成的解决方案,适用于需要在移动设备上选择日期和时间的应用场景。 ## 项目核心功能 1. **日期和时间模式支持**:Vue Datetime 支持日期、日期时间以及时间模式,用户可以根据需求选择不同的模式。 2. ...

gitblog_00629的博客 469

SAP RAP 校验全流程:从 EML 读取到消息上屏与阻止落库

本文系统梳理了 SAP ABAP RAP 中的校验流程(The Validation Process),结合 Airline/Connection 案例,详细讲解了三类核心校验:语义键唯一性、外键有效性和字段间一致性。文章覆盖了 EML 的 READ ENTITIES 操作、reported-* 与 failed-* 结构的使用方法、消息创建与字段绑定技巧,以及处理草稿数据时的 UNION 查询策略。通过代码示例演示了如何实现校验逻辑、生成错误消息并阻止无效数据持久化,同时提供了常见问题的排查建议。全文注重

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 344

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

js手机端时间区间_移动端网页轻量级日期控件LCalenda

插件描述:LCalendar移动端日期时间选择控件注:请在移动端查看效果。LCalendar纯原生js的移动端日期插件,不依赖任何库,体积非常小只有10k用法在html页面中引入input标签,通过自定义属性data-lcalendar控制最小日期和最大日期,写法如下:......将样式文件引入到页面中:......同时引入js文件到页面中:......初始化插件:...varcalendar...

weixin_33848436的博客 1576

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

el-date-picker日期时间选择器,不可选择当前系统时间之前的日期时间,具体到小时(含两种样式)

使用ElementUI的el-date-picker日期时间选择器,不可选择当前系统时间之前的日期时间,具体到小时,选择器选择的范围展示也具体到小时

m0_64393334的博客 1673

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Vue日期时间选择器组件

这里写自定义目录标题1.效果图如下2.准备3.具体实现 1.效果图如下 单选日期选择器 多选日期选择器 日期时间选择器 2.准备 Date原型格式化工具方法 Date.prototype.format = function(fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": th...

xld的博客 1万+

layui 日期时间控件

引入css js 首先我们需要引入layui css js 样式 然后自己定义路径引入 1 页面样式 下面展示一些 内联代码片。 开始时间 <input type="text" class="layui-input" name="beginDate" id="test1" placeholder=""> 结束时间 <input type="text" class="layui-input" name="endDate" id="test2" placeholder=""> 2

myNameIsOwen的博客 1078

一个类似于Pl/SQL Developer的DateTime选择的Javascript日历控件

#RoyalCalendar{visibility:hidden;cursor:default;background-color:#E9E9E9;position:absolute;top:0;left:0;width:90px;height:200px;border:solid black 1px;font:normal normal lighter 9pt}#RoyalCalend

That's it! 1423

Element ui DateTimePicker 日期时间选择器选择时分秒修改鼠标悬停背景颜色

摘要:针对时间选择器组件样式问题,通过CSS代码优化背景色和交互效果。修改后统一采用白色背景,去除了灰色背景的突兀感,并优化了hover状态样式。新增代码去除了上下分割线,确保视觉统一性。关键修改包括设置默认背景色为白色,以及调整禁用状态和激活状态下的样式表现。这些调整提升了组件的美观性和用户体验。

蓝胖子的博客 477

微信小程序—时间选择器:时分秒

最近在做小程序中,其中自带的时间选择器没有秒数,所以上网查了很多方法,但是过跟我的想不同,所以根据其他人的,自己写了我自己的方法。

mjcays的博客 8102

jquery日期时间控件

代码下载地址: jquery日期时间控件下载地址。工作中用到, 这里分享一下, 避免重复摸索劳动。 一、 HTML 文件 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <...

weixin_30266829的博客 100

Web App----时间日期

使用时间日期时,需要引用两个新文件:mui.picker.min.js 和mui.picker.min.css datetime 年月日时分 hour 年月日时 date 年月日 time 时分 month 年月 var picker = new mui.DtPicker({ type: "datetime ", //datetime :年月日时分 ...

m0_58760840的博客 334

Mobiscroll — 配合jQuery Mobile 的日期选择控件附DEMO

$(function () {       var currYear = (new Date()).getFullYear();         var opt={};       opt.date = {preset : 'date'};       //opt.datetime = { preset : 'datetime', minDate: new Date(2012,3,10,9

飞扬小阁 6330

时间选择器

1.加载juqery.datetimepicker.css和jquery.datetimepicker.full.js 2. input type="text" class="form-control" id="datetimepicker" name="key"> 3. $('#datetimepicker').datetimepicker(); 效果图:

qq1317857468的博客 359
上一篇: Javascript+ASP处理表单的生成与验证
下一篇: 极品推荐输入框日期选择效果
SDTerminator
博客等级 码龄19年 10粉丝 7原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址