CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

请问有没有更好的日期表单控件来代替文本框,谢谢,在线100分~

楼主mydo(侯佩|hopy|ks)2006-04-12 08:15:44 在 Web 开发 / ASP 提问

在网页中要求用户输入某一日期值:2006-4-25  
   
  我现在用的是文本框,但是有没有这样一种   activex   控件或其他可在网页  
  中使用的表单控件,可以用图形的方式更形象地让用户选择输入,用过   vb   的  
  兄弟姐妹应该知道   vb   中有一个日期输入的控件,那么这里有类似的么?谢谢 问题点数:100、回复次数:20Top

1 楼chzxq(毛毛鼠)回复于 2006-04-12 08:18:17 得分 10

http://community.csdn.net/Expert/topic/4677/4677183.xml?temp=.527096Top

2 楼sy_binbin()回复于 2006-04-12 08:54:34 得分 15

Calendar.htm  
   
  <HTML>  
  <HEAD>  
  <TITLE>Untitled</TITLE>  
  <META   http-equiv="Content-Type"   content="text/html;   charset=ks_c_5601-1987">  
  <META   content="MSHTML   5.50.4134.100"   name="GENERATOR">  
  <style>  
  TD{   FONT-SIZE:   8pt;  
                  COLOR:   #000000;  
                  FONT-FAMILY:"arial";  
          }  
  </style>  
   
  </HEAD>  
   
  <BODY   background="../image/all_bg.gif"   topmargin="0"   leftmargin="0">  
  <SCRIPT   language="JScript">  
  <!--   Begin     //place   these   scripts   within   BODY   tag   if   you   are   using   IE   4.0   or   below.  
  //****************************************************************************  
  //   PopCalendar   4.1,   Emailware(please   mail&commend   me   if   u   like   it)  
  //   Originally   coded   by   Liming(Victor)   Weng,   email:   victorwon@netease.com  
  //   Release   date:   2000.5.9  
  //   Anyone   may   modify   it   to   satify   his   needs,   but   please   leave   this   comment   ahead.  
  //****************************************************************************  
   
  var   gdCtrl   =   new   Object();  
  var   gcGray   =   "#999999";  
  var   gcToggle   =   "#FED2C8";  
  var   gcBG   =   "#FFFFFF";  
  var   gcBG2   =   "#FFAAAA"  
  var   tableColor   =   "#F5F5F5"  
  var   leftvalue     =   new   Object();  
  var   topvalue       =   new   Object();  
   
  var   gdCurDate   =   new   Date();  
  var   giYear   =   gdCurDate.getFullYear();  
  var   giMonth   =   gdCurDate.getMonth()+1;  
  var   giDay   =   gdCurDate.getDate();  
  var   VicPopCal   =   new   Object();  
  var   yoiltext     =   new   Object();  
  //****************************************************************************  
  //   Param:   popCtrl   is   the   widget   beyond   which   you   want   this   calendar   to   appear;  
  //                 dateCtrl   is   the   widget   into   which   you   want   to   put   the   selected   date;  
  //                 popCal   is   the   widget   to   display   the   calendar;      
  //   i.e.:   <input   type="text"   name="dc"   style="text-align:center"   readonly><INPUT   type="button"   value="V"   onclick="fPopCalendar(dc,dc,popCal);return   false">  
  //****************************************************************************  
   
   
  function   fPopCalendar(popCtrl,   dateCtrl,   popCal,dd,cc,yoil){  
      parent.event.cancelBubble=true;  
      VicPopCal   =   popCal;  
      gdCtrl   =   dateCtrl;      
      yoiltext   =   yoil;  
      fSetYearMon(giYear,   giMonth);  
      var   leftvalue         =   dd;  
      var   topvalue         =   cc;  
      var   point   =   fGetXY(popCtrl);  
      with   (VicPopCal.style)   {  
      left   =   point.x-leftvalue;  
  top     =   point.y+popCtrl.offsetHeight-topvalue;  
  visibility   =   'visible';  
      }  
      VicPopCal.focus();  
      //   in   order   to   make   compatible   with   IE4.x   ,   here   I   cut   two   line   below   off.  
      //   VicPopCal.all("popFrame").width=document.all("popTable").offsetWidth;  
      //   VicPopCal.all("popFrame").height=document.all("popTable").offsetHeight;  
      //   if   u   only   target   on   IE5.x,   uncommented   them   and   delete   the   width&height   prop   in   <IFrame>   tag  
      //   thus   you   will   find   the   3rd   para   in   fDrawCal()   now   works   perfectly.  
  }  
   
  function   Point(iX,   iY){  
  this.x   =   iX;  
  this.y   =   iY;  
  }  
   
  function   fGetXY(aTag){  
              var   oTmp   =   aTag;  
              var   pt   =   new   Point(0,0);  
              do{  
              pt.x   +=   oTmp.offsetLeft;  
              pt.y   +=   oTmp.offsetTop;  
              oTmp   =   oTmp.offsetParent;  
              }while(oTmp.tagName!="BODY");  
              return   pt;  
        }  
   
   
  function   fSetDate(iYear,   iMonth,   iDay){     //&#47112;&#51060;&#50612;   &#46916;&#50868;   &#54168;&#51060;&#51648;&#51032;   &#53581;&#49828;&#53944;   &#48149;&#49828;&#50640;   &#51077;&#47141;&#44050;   &#46308;&#50612;&#44048;..        
  now   =   new   Date();    
  var   date     =   new   Date(iYear,iMonth,iDay);  
  var   yoil     =   eval(date.getDay());       //&#54788;&#51116;&#49440;&#53469;&#54620;   &#45216;&#51676;..  
  week   =   new   Array(0,1,2,3,4,5,6);    
  weekday   =   week[now.getDay()];    
  switch   (eval(now.getMonth())   -   eval(iMonth)){  
  case   -1   :   yoil   =   yoil  
  break;  
  case   0       :   yoil   =   yoil   -1  
  break;  
  case   -2     :   yoil   =   yoil   -   1  
  break   ;  
  }  
  var   ww;  
  switch   (yoil)   {  
  case   2   :   ww   =   "(&#51068;)"  
  break;  
  case   3   :   ww   =   "(月)"  
  break;  
  case   4   :   ww   =   "(&#54868;)"  
  break;  
  case   5   :   ww   =   "(&#49688;)"  
  break;  
  case   6   :   ww   =   "(&#47785;)"  
  break;  
  case   0   :   ww   =   "(&#44552;)"  
  break;  
  case   1   :   ww   =   "(&#53664;)"  
  break;  
  }  
      iMonth   =   "0"   +   iMonth;  
      iMonth       =   iMonth.substring(iMonth.length-2,iMonth.length);  
      iDay       =   "0"   +   iDay;  
      iDay       =   iDay.substring(iDay.length-2,iDay.length);  
      gdCtrl.value   =   iYear+"-"+   iMonth+"-"+iDay;   //Here,   you   could   modify   the   locale   as   you   need   !!!!      
      yoiltext.value   =   ww;  
      VicPopCal.style.visibility   =   "hidden";  
  }  
   
  function   fSetSelected(aCell){  
      var   iOffset   =   0;  
      var   iYear   =   parseInt(tbSelYear.value);  
      var   iMonth   =   parseInt(tbSelMonth.value);  
   
      aCell.bgColor   =   gcBG;  
      with   (aCell.children["cellText"]){  
      var   iDay   =   parseInt(innerText);  
      if   (color==gcGray)  
  iOffset   =   (Victor<10)?-1:1;  
  iMonth   +=   iOffset;  
  if   (iMonth<1)   {  
  iYear--;  
  iMonth   =   12;  
  }else   if   (iMonth>12){  
  iYear++;  
  iMonth   =   1;  
  }  
      }  
      fSetDate(iYear,   iMonth,   iDay);  
  }  
   
  function   fBuildCal(iYear,   iMonth)   {  
      var   aMonth=new   Array();  
      for(i=1;i<7;i++)  
      aMonth[i]=new   Array(i);  
   
      var   dCalDate=new   Date(iYear,   iMonth-1,   1);  
      var   iDayOfFirst=dCalDate.getDay();  
      var   iDaysInMonth=new   Date(iYear,   iMonth,   0).getDate();  
      var   iOffsetLast=new   Date(iYear,   iMonth-1,   0).getDate()-iDayOfFirst+1;  
      var   iDate   =   1;  
      var   iNext   =   1;  
   
      for   (d   =   0;   d   <   7;   d++)  
  aMonth[1][d]   =   (d<iDayOfFirst)?-(iOffsetLast+d):iDate++;  
      for   (w   =   2;   w   <   7;   w++)  
      for   (d   =   0;   d   <   7;   d++)  
  aMonth[w][d]   =   (iDate<=iDaysInMonth)?iDate++:-(iNext++);  
      return   aMonth;  
  }  
   
  function   fDrawCal(iYear,   iMonth,   iCellWidth,   iDateTextSize)   {  
      var   WeekDay   =   new   Array("S","M","T","W","T","F","S");  
      var   Today=new   Date()  
      var   styleTD   =   "   bgcolor='"+gcBG+"'   width='"+iCellWidth+"'   bordercolor='"+gcBG+"'   valign='middle'   align='center'     style='font:text"+iDateTextSize+"   Courier;";  
      var   styleTD2   =   "   bgcolor='"+gcBG2+"'   width='"+iCellWidth+"'   bordercolor='"+gcBG+"'   valign='middle'   align='center'     style='font-weight:bold;font:text;color:#ffffff;'"+iDateTextSize+"   Courier;";  
      with   (document)   {  
  write("<tr>");  
  for(i=0;   i<7;   i++)  
  write("<td   "+styleTD2+"'>"   +   WeekDay[i]   +   "</td>");  
  write("</tr>");  
      for   (w   =   1;   w   <   7;   w++)   {  
  write("<tr>");  
  for   (d   =   0;   d   <   7;   d++)   {  
  write("<td   id=calCell   align=center   onMouseOver='this.bgColor=gcToggle'   onMouseOut='this.bgColor=gcBG'   onclick='fSetSelected(this)'>");  
  write("<font   id=cellText     font   style='cursor:hand'   Victor='Liming   Weng'>   </font>");  
  write("</td>")  
  }  
  write("</tr>");  
  }  
      }  
  }  
   
  Top

3 楼sy_binbin()回复于 2006-04-12 08:54:41 得分 0

function   fUpdateCal(iYear,   iMonth)   {  
      myMonth   =   fBuildCal(iYear,   iMonth);  
      var   i   =   0;  
      var   today=new   Date()  
      for   (w   =   0;   w   <   6;   w++)  
  for   (d   =   0;   d   <   7;   d++)  
  with   (cellText[(7*w)+d])   {  
  Victor   =   i++;  
  if   (myMonth[w+1][d]<0)   {  
  color   =   gcGray;  
  innerText   =   -myMonth[w+1][d];  
  temp=-myMonth[w+1][d]  
  }else{  
  if   (d==0)   {  
  color   =   "#ff0000";  
  }  
  else   if(d==6)   {  
  color   =   "#0066FF";  
  }  
  else{  
  color="black";  
  }  
  innerText   =   myMonth[w+1][d];  
  }  
  if   (today.getYear()==iYear&&today.getMonth()+1==iMonth&&today.getDate()==myMonth[w+1][d])  
  calCell[(7*w)+d].bgColor=gcToggle;  
  else  
  calCell[(7*w)+d].bgColor=gcBG;  
  }  
  }  
   
  function   fSetYearMon(iYear,   iMon){  
      tbSelMonth.options[iMon-1].selected   =   true;  
      for   (i   =   0;   i   <   tbSelYear.length;   i++)  
  if   (tbSelYear.options[i].value   ==   iYear)  
  tbSelYear.options[i].selected   =   true;  
      fUpdateCal(iYear,   iMon);  
  }  
   
  function   fPrevMonth(){  
      var   iMon   =   tbSelMonth.value;  
      var   iYear   =   tbSelYear.value;  
   
      if   (--iMon<1)   {  
      iMon   =   12;  
      iYear--;  
      }  
   
      fSetYearMon(iYear,   iMon);  
  }  
   
  function   fNextMonth(){  
      var   iMon   =   tbSelMonth.value;  
      var   iYear   =   tbSelYear.value;  
   
      if   (++iMon>12)   {  
      iMon   =   1;  
      iYear++;  
      }  
   
      fSetYearMon(iYear,   iMon);  
  }  
   
  var   gMonths   =   new   Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");  
   
  with   (document)   {  
  write("<table   border='0'   align='center'   cellspacing='2'   cellpadding='1'   bgcolor='#D0D0D0'><tr><td>");  
  write("<table   id='popTable'   border='0'   align=center   bgcolor='#ffffff'>");  
  write("<TR>");  
  write("<td   valign='middle'   align='center'><input   type='image'   src='/Images/btn/arrow_left.gif'   name='PrevMonth'     onClick='fPrevMonth()'   width='9'   height='9'   onfocus='this.blur()'>");   //&#51204;月&#47196;   &#51060;&#46041;  
  write("&nbsp;<SELECT   name='tbSelYear'   style='font-size:8pt'   onChange='fUpdateCal(tbSelYear.value,   tbSelMonth.value)'   Victor='Won'>");  
  for(i=1920;i<2010;i++)  
  write("<OPTION   value='"+i+"'>"+i+"年</OPTION>");  
  write("</SELECT>");  
  write("&nbsp;<select   name='tbSelMonth'   style='font-size:8pt'   onChange='fUpdateCal(tbSelYear.value,   tbSelMonth.value)'   Victor='Won'>");  
  for   (i=0;   i<12;   i++)  
  write("<option   value='"+(i+1)+"'>"+gMonths[i]+"</option>");  
  write("</SELECT>");  
   
  write("&nbsp;<input   type='image'   src='/Images/btn/arrow_right.gif'   name='PrevMonth'   onclick='fNextMonth()'   width='9'   height='9'   onfocus='this.blur()'>");//&#45796;&#51020;&#45804;&#47196;   &#51060;&#46041;  
  write("</td>");  
  write("</TR><TR>");  
  write("<td   align='center'>");  
  write("<DIV><table   width='100%'   border='0'   height=90   cellpadding='1'   cellspacing='0'   bgcolor='#ffffff'>");  
  fDrawCal(giYear,   giMonth,   19,   12);  
  write("</table></DIV>");  
  write("</td>");  
  write("</TR><tr><td   height='1'   bgcolor='#CCCCCC'></td></tr>");  
  write("<TR><TD   align='center'>");  
  write("<font   style='cursor:hand'   onclick='fSetDate(giYear,giMonth,giDay)'><u>Today</u></font>");  
  write("</TD></TR>");  
  write("</TABLE>");  
  write("</tr></td></table>");  
  }  
  </SCRIPT>  
  </BODY>  
  </HTML>  
  <script   event="onclick()"   for="document">  
  //popDate.style.visibility   =   "hidden";  
  </script>Top

4 楼yeaky()回复于 2006-04-12 08:56:40 得分 15

<form   name="form1"   method="post"   action=""><input   type=text   name="datebox"   size=15   onFocus="this.blur()"><a   href="javascript:show_calendar('form1.datebox');"   onmouseover="window.status='Date   Picker';return   true;"   onmouseout="window.status='';return   true;"><img   src="show-calendar.gif"   width=24   height=22   border=0></a>  
  </form>  
  <script>  
  var   weekend   =   [0,6];  
  var   weekendColor   =   "#e0e0e0";  
  var   fontface   =   "Verdana";  
  var   fontsize   =   2;  
  var   gNow   =   new   Date();  
  var   ggWinCal;  
  isNav   =   (navigator.appName.indexOf("Netscape")   !=   -1)   ?   true   :   false;  
  isIE   =   (navigator.appName.indexOf("Microsoft")   !=   -1)   ?   true   :   false;  
  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_WinCal,   p_month,   p_year,   p_format)   {  
  if   ((p_month   ==   null)   &&   (p_year   ==   null)) return;  
  if   (p_WinCal   ==   null)  
  this.gWinCal   =   ggWinCal;  
  else  
  this.gWinCal   =   p_WinCal;  
   
  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;  
  Calendar.print   =   Calendar_print;  
  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_print()   {  
  ggWinCal.print();  
  }  
  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   =   vCode   +   "<TABLE   BORDER=1   BGCOLOR=\""   +   this.gBGColor   +   "\">";  
   
  vHeader_Code   =   this.cal_header();  
  vData_Code   =   this.cal_data();  
  vCode   =   vCode   +   vHeader_Code   +   vData_Code;  
   
  vCode   =   vCode   +   "</TABLE>";  
   
  return   vCode;  
  }  
  Calendar.prototype.show   =   function()   {  
  var   vCode   =   "";  
   
  this.gWinCal.document.open();  
  //   Setup   the   page...  
  this.wwrite("<html>");  
  this.wwrite("<head><title>Calendar</title>");  
  this.wwrite("</head>");  
  this.wwrite("<body   "   +    
  "link=\""   +   this.gLinkColor   +   "\"   "   +    
  "vlink=\""   +   this.gLinkColor   +   "\"   "   +  
  "alink=\""   +   this.gLinkColor   +   "\"   "   +  
  "text=\""   +   this.gTextColor   +   "\">");  
  this.wwriteA("<FONT   FACE='"   +   fontface   +   "'   SIZE=2><B>");  
  this.wwriteA(this.gMonthName   +   "   "   +   this.gYear);  
  this.wwriteA("</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];  
   
  this.wwrite("<TABLE   WIDTH='100%'   BORDER=1   CELLSPACING=0   CELLPADDING=0   BGCOLOR='#e0e0e0'><TR><TD   ALIGN=center>");  
  this.wwrite("[<A   HREF=\""   +  
  "javascript:window.opener.Build("   +    
  "'"   +   this.gReturnItem   +   "',   '"   +   this.gMonth   +   "',   '"   +   (parseInt(this.gYear)-1)   +   "',   '"   +   this.gFormat   +   "'"   +  
  ");"   +  
  "\"><<<\/A>]</TD><TD   ALIGN=center>");  
  this.wwrite("[<A   HREF=\""   +  
  "javascript:window.opener.Build("   +    
  "'"   +   this.gReturnItem   +   "',   '"   +   prevMM   +   "',   '"   +   prevYYYY   +   "',   '"   +   this.gFormat   +   "'"   +  
  ");"   +  
  "\"><<\/A>]</TD><TD   ALIGN=center>");  
  this.wwrite("[<A   HREF=\"javascript:window.print();\">Print</A>]</TD><TD   ALIGN=center>");  
  this.wwrite("[<A   HREF=\""   +  
  "javascript:window.opener.Build("   +    
  "'"   +   this.gReturnItem   +   "',   '"   +   nextMM   +   "',   '"   +   nextYYYY   +   "',   '"   +   this.gFormat   +   "'"   +  
  ");"   +  
  "\">><\/A>]</TD><TD   ALIGN=center>");  
  this.wwrite("[<A   HREF=\""   +  
  "javascript:window.opener.Build("   +    
  "'"   +   this.gReturnItem   +   "',   '"   +   this.gMonth   +   "',   '"   +   (parseInt(this.gYear)+1)   +   "',   '"   +   this.gFormat   +   "'"   +  
  ");"   +  
  "\">>><\/A>]</TD></TR></TABLE><BR>");  
  //   Get   the   complete   calendar   code   for   the   month..  
  vCode   =   this.getMonthlyCalendarCode();  
  this.wwrite(vCode);  
  this.wwrite("</font></body></html>");  
  this.gWinCal.document.close();  
  }Top

5 楼sy_binbin()回复于 2006-04-12 08:57:20 得分 0

riqi.asp  
   
  <div   id="popDate"   style="BORDER-RIGHT:   1px   ridge;   BORDER-TOP:   1px   ridge;   Z-INDEX:   80;   VISIBILITY:   hidden;   BORDER-LEFT:   1px   ridge;   BORDER-BOTTOM:   1px   ridge;   POSITION:   absolute">    
  <IFRAME   name="popFrame"   src="calendar.htm"   frameBorder="0"   scrolling="no"   width="157"   height="168"></IFRAME>  
  </div>  
  <form   name="form1"   method="post"   action="">  
  <input   name="txtYoil"   id="txtYoil"   type="hidden">  
      <input   name="date"   type="text"   id="date"   value="<%=fileDate%>"   readonly   onclick="popFrame.fPopCalendar(date,date,popDate,0,0,txtYoil);return   false">    
                  <span   class="style1">*格式为2006-03-16</span>  
  </form>  
   
  没测试,是从我以前的代码里考下来达到Top

6 楼yeaky()回复于 2006-04-12 08:57:28 得分 0

Calendar.prototype.showY   =   function()   {  
  var   vCode   =   "";  
  var   i;  
  var   vr,   vc,   vx,   vy; //   Row,   Column,   X-coord,   Y-coord  
  var   vxf   =   285; //   X-Factor  
  var   vyf   =   200; //   Y-Factor  
  var   vxm   =   10; //   X-margin  
  var   vym; //   Y-margin  
  if   (isIE) vym   =   75;  
  else   if   (isNav) vym   =   25;  
   
  this.gWinCal.document.open();  
  this.wwrite("<html>");  
  this.wwrite("<head><title>Calendar</title>");  
  this.wwrite("<style   type='text/css'>\n<!--");  
  for   (i=0;   i<12;   i++)   {  
  vc   =   i   %   3;  
  if   (i>=0   &&   i<=   2) vr   =   0;  
  if   (i>=3   &&   i<=   5) vr   =   1;  
  if   (i>=6   &&   i<=   8) vr   =   2;  
  if   (i>=9   &&   i<=   11) vr   =   3;  
   
  vx   =   parseInt(vxf   *   vc)   +   vxm;  
  vy   =   parseInt(vyf   *   vr)   +   vym;  
  this.wwrite(".lclass"   +   i   +   "   {position:absolute;top:"   +   vy   +   ";left:"   +   vx   +   ";}");  
  }  
  this.wwrite("-->\n</style>");  
  this.wwrite("</head>");  
  this.wwrite("<body   "   +    
  "link=\""   +   this.gLinkColor   +   "\"   "   +    
  "vlink=\""   +   this.gLinkColor   +   "\"   "   +  
  "alink=\""   +   this.gLinkColor   +   "\"   "   +  
  "text=\""   +   this.gTextColor   +   "\">");  
  this.wwrite("<FONT   FACE='"   +   fontface   +   "'   SIZE=2><B>");  
  this.wwrite("Year   :   "   +   this.gYear);  
  this.wwrite("</B><BR>");  
  //   Show   navigation   buttons  
  var   prevYYYY   =   parseInt(this.gYear)   -   1;  
  var   nextYYYY   =   parseInt(this.gYear)   +   1;  
   
  this.wwrite("<TABLE   WIDTH='100%'   BORDER=1   CELLSPACING=0   CELLPADDING=0   BGCOLOR='#e0e0e0'><TR><TD   ALIGN=center>");  
  this.wwrite("[<A   HREF=\""   +  
  "javascript:window.opener.Build("   +    
  "'"   +   this.gReturnItem   +   "',   null,   '"   +   prevYYYY   +   "',   '"   +   this.gFormat   +   "'"   +  
  ");"   +  
  "\"   alt='Prev   Year'><<<\/A>]</TD><TD   ALIGN=center>");  
  this.wwrite("[<A   HREF=\"javascript:window.print();\">Print</A>]</TD><TD   ALIGN=center>");  
  this.wwrite("[<A   HREF=\""   +  
  "javascript:window.opener.Build("   +    
  "'"   +   this.gReturnItem   +   "',   null,   '"   +   nextYYYY   +   "',   '"   +   this.gFormat   +   "'"   +  
  ");"   +  
  "\">>><\/A>]</TD></TR></TABLE><BR>");  
  //   Get   the   complete   calendar   code   for   each   month..  
  var   j;  
  for   (i=11;   i>=0;   i--)   {  
  if   (isIE)  
  this.wwrite("<DIV   ID=\"layer"   +   i   +   "\"   CLASS=\"lclass"   +   i   +   "\">");  
  else   if   (isNav)  
  this.wwrite("<LAYER   ID=\"layer"   +   i   +   "\"   CLASS=\"lclass"   +   i   +   "\">");  
  this.gMonth   =   i;  
  this.gMonthName   =   Calendar.get_month(this.gMonth);  
  vCode   =   this.getMonthlyCalendarCode();  
  this.wwrite(this.gMonthName   +   "/"   +   this.gYear   +   "<BR>");  
  this.wwrite(vCode);  
  if   (isIE)  
  this.wwrite("</DIV>");  
  else   if   (isNav)  
  this.wwrite("</LAYER>");  
  }  
  this.wwrite("</font><BR></body></html>");  
  this.gWinCal.document.close();  
  }  
  Calendar.prototype.wwrite   =   function(wtext)   {  
  this.gWinCal.document.writeln(wtext);  
  }  
  Calendar.prototype.wwriteA   =   function(wtext)   {  
  this.gWinCal.document.write(wtext);  
  }  
  Calendar.prototype.cal_header   =   function()   {  
  var   vCode   =   "";  
   
  vCode   =   vCode   +   "<TR>";  
  vCode   =   vCode   +   "<TD   WIDTH='14%'><FONT   SIZE='2'   FACE='"   +   fontface   +   "'   COLOR='"   +   this.gHeaderColor   +   "'><B>Sun</B></FONT></TD>";  
  vCode   =   vCode   +   "<TD   WIDTH='14%'><FONT   SIZE='2'   FACE='"   +   fontface   +   "'   COLOR='"   +   this.gHeaderColor   +   "'><B>Mon</B></FONT></TD>";  
  vCode   =   vCode   +   "<TD   WIDTH='14%'><FONT   SIZE='2'   FACE='"   +   fontface   +   "'   COLOR='"   +   this.gHeaderColor   +   "'><B>Tue</B></FONT></TD>";  
  vCode   =   vCode   +   "<TD   WIDTH='14%'><FONT   SIZE='2'   FACE='"   +   fontface   +   "'   COLOR='"   +   this.gHeaderColor   +   "'><B>Wed</B></FONT></TD>";  
  vCode   =   vCode   +   "<TD   WIDTH='14%'><FONT   SIZE='2'   FACE='"   +   fontface   +   "'   COLOR='"   +   this.gHeaderColor   +   "'><B>Thu</B></FONT></TD>";  
  vCode   =   vCode   +   "<TD   WIDTH='14%'><FONT   SIZE='2'   FACE='"   +   fontface   +   "'   COLOR='"   +   this.gHeaderColor   +   "'><B>Fri</B></FONT></TD>";  
  vCode   =   vCode   +   "<TD   WIDTH='16%'><FONT   SIZE='2'   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   SIZE='2'   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   SIZE='2'   FACE='"   +   fontface   +   "'>"   +    
  "<A   HREF='#'   "   +    
  "onClick=\"self.opener.document."   +   this.gReturnItem   +   ".value='"   +    
  this.format_data(vDay)   +    
  "';window.close();\">"   +    
  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   SIZE='2'   FACE='"   +   fontface   +   "'>"   +    
  "<A   HREF='#'   "   +    
  "onClick=\"self.opener.document."   +   this.gReturnItem   +   ".value='"   +    
  this.format_data(vDay)   +    
  "';window.close();\">"   +    
  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   SIZE='2'   FACE='"   +   fontface   +   "'   COLOR='gray'>   </FONT></TD>";  
  else  
  vCode   =   vCode   +   "<TD   WIDTH='14%'"   +   this.write_weekend_string(j+m)   +    
  "><FONT   SIZE='2'   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   "";  
  }Top

7 楼yeaky()回复于 2006-04-12 08:57:39 得分 0

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   "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)   {  
  var   p_WinCal   =   ggWinCal;  
  gCal   =   new   Calendar(p_item,   p_WinCal,   p_month,   p_year,   p_format);  
  //   Customize   your   Calendar   here..  
  gCal.gBGColor="white";  
  gCal.gLinkColor="black";  
  gCal.gTextColor="black";  
  gCal.gHeaderColor="darkgreen";  
  //   Choose   appropriate   show   function  
  if   (gCal.gYearly) gCal.showY();  
  else gCal.show();  
  }  
  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   =   "MM/DD/YYYY";  
  else  
  p_format   =   arguments[3];  
  vWinCal   =   window.open("",   "Calendar",    
  "width=250,height=250,status=no,resizable=no,top=200,left=200");  
  vWinCal.opener   =   self;  
  ggWinCal   =   vWinCal;  
  Build(p_item,   p_month,   p_year,   p_format);  
  }  
  /*  
  Yearly   Calendar   Code   Starts   here  
  */  
  function   show_yearly_calendar(p_item,   p_year,   p_format)   {  
  //   Load   the   defaults..  
  if   (p_year   ==   null   ||   p_year   ==   "")  
  p_year   =   new   String(gNow.getFullYear().toString());  
  if   (p_format   ==   null   ||   p_format   ==   "")  
  p_format   =   "MM/DD/YYYY";  
  var   vWinCal   =   window.open("",   "Calendar",   "scrollbars=yes");  
  vWinCal.opener   =   self;  
  ggWinCal   =   vWinCal;  
  Build(p_item,   null,   p_year,   p_format);  
  }  
  </script>Top

8 楼yeaky()回复于 2006-04-12 08:58:07 得分 0

晕,好快  
  抢楼啊。。。。Top

9 楼sy_binbin()回复于 2006-04-12 09:05:00 得分 0

楼主在看代码的时候要注意了哦!不要弄浑了Top

10 楼uddtxgt(闫)回复于 2006-04-12 09:27:57 得分 10

在网上找个这种的日历控件就可以了,也就是一个JS文件,之后嵌入到你的相关页,调用就OK了~  
  须要发给你~Top

11 楼skhs()回复于 2006-04-12 09:43:48 得分 5

看看梅花雨的。Top

12 楼mydo(侯佩|hopy|ks)回复于 2006-04-12 10:47:09 得分 0

晕~这么多Top

13 楼zhanghongwen(流氓蚊子)回复于 2006-04-12 11:18:28 得分 15

给你一人JS的.  
  <script   language=javascript>  
  <!--  
  document.writeln('<div   id=meizzDateLayer   style="position:   absolute;   width:   142;   height:   166;   z-index:   9998;   display:   none">');  
  document.writeln('<span   id=tmpSelectYearLayer     style="z-index:   9999;position:   absolute;top:   2;   left:   18;display:   none"></span>');  
  document.writeln('<span   id=tmpSelectMonthLayer   style="z-index:   9999;position:   absolute;top:   2;   left:   75;display:   none"></span>');  
  document.writeln('<table   border=0   cellspacing=1   cellpadding=0   width=142   height=160   bgcolor=#808080   onselectstart="return   false">');  
  document.writeln('     <tr><td   width=142   height=23   bgcolor=#FFFFFF><table   border=0   cellspacing=1   cellpadding=0   width=140   height=23>');  
  document.writeln('             <tr   align=center><td   width=20   align=center   bgcolor=#808080   style="font-size:12px;cursor:   hand;color:   #FFD700"   ');  
  document.writeln('                 onclick="meizzPrevM()"   title="向前翻 月"   Author=meizz><b   Author=meizz>&lt;&lt;</b>');  
  document.writeln('                 </td><td   width=100   align=center   style="font-size:12px;cursor:default"   Author=meizz>');  
  document.writeln('                 <span   Author=meizz   id=meizzYearHead   onclick="tmpSelectYearInnerHTML(this.innerText)"></span>&nbsp;年&nbsp;<span');  
  document.writeln('                   id=meizzMonthHead   Author=meizz   onclick="tmpSelectMonthInnerHTML(this.innerText)"></span>&nbsp;月</td>');  
  document.writeln('                 <td   width=20   bgcolor=#808080   align=center   style="font-size:12px;cursor:   hand;color:   #FFD700"   ');  
  document.writeln('                   onclick="meizzNextM()"   title="往后翻 月"   Author=meizz><b   Author=meizz>&gt;&gt;</b></td></tr>');  
  document.writeln('         </table></td></tr>');  
  document.writeln('     <tr><td   width=142   height=18   bgcolor=#808080>');  
  document.writeln('<table   border=0   cellspacing=0   cellpadding=0   width=140   height=1   style="cursor:default">');  
  document.writeln('<tr   align=center><td   style="font-size:12px;color:#FFFFFF"   Author=meizz>日</td>');  
  document.writeln('<td   style="font-size:12px;color:#FFFFFF"   Author=meizz>一</td><td   style="font-size:12px;color:#FFFFFF"   Author=meizz>二</td>');  
  document.writeln('<td   style="font-size:12px;color:#FFFFFF"   Author=meizz>三</td><td   style="font-size:12px;color:#FFFFFF"   Author=meizz>四</td>');  
  document.writeln('<td   style="font-size:12px;color:#FFFFFF"   Author=meizz>五</td><td   style="font-size:12px;color:#FFFFFF"   Author=meizz>六</td></tr>');  
  document.writeln('</table></td></tr><!--   Author:F.R.Huang(meizz)   http://www.meizz.com/   mail:   meizz@hzcnc.com   2002-10-8   -->');  
  document.writeln('     <tr><td   width=142   height=120>');  
  document.writeln('         <table   border=0   cellspacing=1   cellpadding=0   width=140   height=120   bgcolor=#FFFFFF>');  
  var   n=0;   for   (j=0;j<5;j++){   document.writeln   ('   <tr   align=center>');   for   (i=0;i<7;i++){  
  document.writeln('<td   width=20   height=20   id=meizzDay'+n+'   style="font-size:12px"   Author=meizz   onclick=meizzDayClick(this.innerText)></td>');n++;}  
  document.writeln('</tr>');}  
  document.writeln('             <tr   align=center><td   width=20   height=20   style="font-size:12px"   id=meizzDay35   Author=meizz   ');  
  document.writeln('                   onclick=meizzDayClick(this.innerText)></td>');  
  document.writeln('                 <td   width=20   height=20   style="font-size:12px"   id=meizzDay36   Author=meizz   onclick=meizzDayClick(this.innerText)></td></tr>');  
  document.writeln('         </table></td></tr><tr><td>');  
  document.writeln('                 <table   border=0   cellspacing=1   cellpadding=0   width=100%   bgcolor=#FFFFFF>');  
  document.writeln('                     <tr><td   Author=meizz   align=left><input   Author=meizz   type=button   value="<<"   title="向前翻 年"   onclick="meizzPrevY()"   ');  
  document.writeln('                           onfocus="this.blur()"   style="font-size:   12px;   height:   20px"><input   Author=meizz   title="向前翻 月"   type=button   ');  
  document.writeln('                           value="<"   onclick="meizzPrevM()"   onfocus="this.blur()"   style="font-size:   12px;   height:   20px"></td><td   ');  
  document.writeln('                           Author=meizz   align=center><input   Author=meizz   type=button   value=今天   onclick="meizzToday()"   ');  
  document.writeln('                           onfocus="this.blur()"   title="转到今天的日期"   style="font-size:   12px;   height:   20px"></td><td   ');  
  document.writeln('                           Author=meizz   align=right><input   Author=meizz   type=button   value=">"   onclick="meizzNextM()"   ');  
  document.writeln('                           onfocus="this.blur()"   title="往后翻 月"   style="font-size:   12px;   height:   20px"><input   ');  
  document.writeln('                           Author=meizz   type=button   value=">>"   title="往后翻 年"   onclick="meizzNextY()"');  
  document.writeln('                           onfocus="this.blur()"   style="font-size:   12px;   height:   20px"></td>');  
  document.writeln('</tr></table></td></tr></table></div>');   
  var   outObject;  
  function   setday(tt,obj)   //主调函数  
  {  
      if   (arguments.length   >     2){alert("对不起!传入本控件的参数太多!");return;}  
      if   (arguments.length   ==   0){alert("对不起!您没有传回本控件任何参数!");return;}  
      var   dads     =   document.all.meizzDateLayer.style;var   th   =   tt;  
      var   ttop     =   tt.offsetTop;           //TT控件的定位点高  
      var   thei     =   tt.clientHeight;     //TT控件本身的高  
      var   tleft   =   tt.offsetLeft;         //TT控件的定位点宽  
      var   ttyp     =   tt.type;                     //TT控件的类型  
      while   (tt   =   tt.offsetParent){ttop+=tt.offsetTop;   tleft+=tt.offsetLeft;}  
      dads.top     =   (ttyp=="image")?   ttop+thei   :   ttop+thei+6;  
      dads.left   =   tleft;  
      outObject   =   (arguments.length   ==   1)   ?   th   :   obj;  
      dads.display   =   '';  
      event.returnValue=false;  
  }   
   
  var   MonHead   =   new   Array(12);                               //定义阳历中每个月的最大天数  
          MonHead[0]   =   31;   MonHead[1]   =   28;   MonHead[2]   =   31;   MonHead[3]   =   30;   MonHead[4]     =   31;   MonHead[5]     =   30;  
          MonHead[6]   =   31;   MonHead[7]   =   31;   MonHead[8]   =   30;   MonHead[9]   =   31;   MonHead[10]   =   30;   MonHead[11]   =   31;   
   
  var   meizzTheYear=new   Date().getFullYear();   //定义年的变量的初始值  
  var   meizzTheMonth=new   Date().getMonth()+1;   //定义月的变量的初始值  
  var   meizzWDay=new   Array(37);                               //定义写日期的数组   
   
  function   document.onclick()   //任意点击时关闭该控件  
  {    
      with(window.event.srcElement)  
      {   if   (tagName   !=   "INPUT"   &&   getAttribute("Author")==null)  
          document.all.meizzDateLayer.style.display="none";  
      }  
  }   
   
  function   meizzWriteHead(yy,mm)     //往   head   中写入当前的年与月  
      {   document.all.meizzYearHead.innerText     =   yy;  
          document.all.meizzMonthHead.innerText   =   mm;  
      }   
   
  function   tmpSelectYearInnerHTML(strYear)   //年份的下拉框  
  {  
      if   (strYear.match(/\D/)!=null){alert("年份输入参数不是数字!");return;}  
      var   m   =   (strYear)   ?   strYear   :   new   Date().getFullYear();  
      if   (m   <   1000   ||   m   >   9999)   {alert("年份值不在   1000   到   9999   之间!");return;}  
      var   n   =   m   -   10;  
      if   (n   <   1000)   n   =   1000;  
      if   (n   +   26   >   9999)   n   =   9974;  
      var   s   =   "<select   Author=meizz   name=tmpSelectYear   style='font-size:   12px'   "  
            s   +=   "onblur='document.all.tmpSelectYearLayer.style.display=\"none\"'   "  
            s   +=   "onchange='document.all.tmpSelectYearLayer.style.display=\"none\";"  
            s   +=   "meizzTheYear   =   this.value;   meizzSetDay(meizzTheYear,meizzTheMonth)'>\r\n";  
      var   selectInnerHTML   =   s;  
      for   (var   i   =   n;   i   <   n   +   26;   i++)  
      {  
          if   (i   ==   m)  
                {selectInnerHTML   +=   "<option   value='"   +   i   +   "'   selected>"   +   i   +   "年"   +   "</option>\r\n";}  
          else   {selectInnerHTML   +=   "<option   value='"   +   i   +   "'>"   +   i   +   "年"   +   "</option>\r\n";}  
      }  
      selectInnerHTML   +=   "</select>";  
      document.all.tmpSelectYearLayer.style.display="";  
      document.all.tmpSelectYearLayer.innerHTML   =   selectInnerHTML;  
      document.all.tmpSelectYear.focus();  
  }   
   
  Top

14 楼zhanghongwen(流氓蚊子)回复于 2006-04-12 11:18:39 得分 0

function   tmpSelectMonthInnerHTML(strMonth)   //月份的下拉框  
  {  
      if   (strMonth.match(/\D/)!=null){alert("月份输入参数不是数字!");return;}  
      var   m   =   (strMonth)   ?   strMonth   :   new   Date().getMonth()   +   1;  
      var   s   =   "<select   Author=meizz   name=tmpSelectMonth   style='font-size:   12px'   "  
            s   +=   "onblur='document.all.tmpSelectMonthLayer.style.display=\"none\"'   "  
            s   +=   "onchange='document.all.tmpSelectMonthLayer.style.display=\"none\";"  
            s   +=   "meizzTheMonth   =   this.value;   meizzSetDay(meizzTheYear,meizzTheMonth)'>\r\n";  
      var   selectInnerHTML   =   s;  
      for   (var   i   =   1;   i   <   13;   i++)  
      {  
          if   (i   ==   m)  
                {selectInnerHTML   +=   "<option   value='"+i+"'   selected>"+i+"月"+"</option>\r\n";}  
          else   {selectInnerHTML   +=   "<option   value='"+i+"'>"+i+"月"+"</option>\r\n";}  
      }  
      selectInnerHTML   +=   "</select>";  
      document.all.tmpSelectMonthLayer.style.display="";  
      document.all.tmpSelectMonthLayer.innerHTML   =   selectInnerHTML;  
      document.all.tmpSelectMonth.focus();  
  }   
   
  function   closeLayer()                               //这个层的关闭  
   
      {  
          document.all.meizzDateLayer.style.display="none";  
      }   
   
  function   document.onkeydown()  
      {  
          if   (window.event.keyCode==27)document.all.meizzDateLayer.style.display="none";  
      }   
   
  function   IsPinYear(year)                         //判断是否闰平年  
      {  
          if   (0==year%4&&((year%100!=0)||(year%400==0)))   return   true;else   return   false;  
      }   
   
  function   GetMonthCount(year,month)     //闰年二月为29天  
      {  
          var   c=MonHead[month-1];if((month==2)&&IsPinYear(year))   c++;return   c;  
      }   
   
   
  function   GetDOW(day,month,year)           //求某天的星期几  
      {  
          var   dt=new   Date(year,month-1,day).getDay()/7;   return   dt;  
      }   
   
  function   meizzPrevY()     //往前翻   Year  
      {  
          if(meizzTheYear   >   999   &&   meizzTheYear   <10000){meizzTheYear--;}  
          else{alert("年份超出范围(1000-9999)!");}  
          meizzSetDay(meizzTheYear,meizzTheMonth);  
      }  
  function   meizzNextY()     //往后翻   Year  
      {  
          if(meizzTheYear   >   999   &&   meizzTheYear   <10000){meizzTheYear++;}  
          else{alert("年份超出范围(1000-9999)!");}  
          meizzSetDay(meizzTheYear,meizzTheMonth);  
      }  
  function   meizzToday()     //Today   Button  
      {  
          meizzTheYear   =   new   Date().getFullYear();  
          meizzTheMonth   =   new   Date().getMonth()+1;  
          meizzSetDay(meizzTheYear,meizzTheMonth);  
      }  
  function   meizzPrevM()     //往前翻月份  
      {  
          if(meizzTheMonth>1){meizzTheMonth--}else{meizzTheYear--;meizzTheMonth=12;}  
          meizzSetDay(meizzTheYear,meizzTheMonth);  
      }  
  function   meizzNextM()     //往后翻月份  
      {  
          if(meizzTheMonth==12){meizzTheYear++;meizzTheMonth=1}else{meizzTheMonth++}  
          meizzSetDay(meizzTheYear,meizzTheMonth);  
      }   
   
  function   meizzSetDay(yy,mm)       //主要的写程序**********  
  {  
      meizzWriteHead(yy,mm);  
      for   (var   i   =   0;   i   <   37;   i++){meizzWDay[i]=""};     //将显示框的内容全部清空  
      var   day1   =   1,firstday   =   new   Date(yy,mm-1,1).getDay();     //某月第一天的星期几  
      for   (var   i   =   firstday;   day1   <   GetMonthCount(yy,mm)+1;   i++){meizzWDay[i]=day1;day1++;}  
      for   (var   i   =   0;   i   <   37;   i++)  
      {   var   da   =   eval("document.all.meizzDay"+i)           //书写新的一个月的日期星期排列  
          if   (meizzWDay[i]!="")  
              {   da.innerHTML   =   "<b>"   +   meizzWDay[i]   +   "</b>";  
                  da.style.backgroundColor   =   (yy   ==   new   Date().getFullYear()   &&  
                  mm   ==   new   Date().getMonth()+1   &&   meizzWDay[i]   ==   new   Date().getDate())   ?   "#FFD700"   :   "#ADD8E6";  
                  da.style.cursor="hand"  
              }  
          else{da.innerHTML="";da.style.backgroundColor="";da.style.cursor="default"}  
      }  
  }  
  function   meizzDayClick(n)     //点击显示框选取日期,主输入函数*************  
  {  
      var   yy   =   meizzTheYear;  
      var   mm   =   meizzTheMonth;  
      if   (mm   <   10){mm   =   "0"   +   mm;}  
      if   (outObject)  
      {  
          if   (!n)   {outObject.value="";   return;}  
          if   (   n   <   10){n   =   "0"   +   n;}  
          outObject.value=   yy   +   "-"   +   mm   +   "-"   +   n   ;   //注:在这里你可以输出改成你想要的格式  
          closeLayer();    
      }  
      else   {closeLayer();   alert("您所要输出的控件对象并不存在!");}  
  }  
  meizzSetDay(meizzTheYear,meizzTheMonth);  
  //   -->  
  </script>  
   
  调用:  
                  <input   name="kstime"   type="text"   class="textbox"   id="kstime"   onFocus="setday(this)"   size="12"   >  
  Top

15 楼marxian(小玛仙)回复于 2006-04-12 14:32:39 得分 10

var   oCalendarChs=new   PopupCalendar("oCalendarChs");  
  //oCalendarChs.weekDaySting=new   Array("日","月","火","水","木","金","土");  
  oCalendarChs.monthSting=new   Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");  
  oCalendarChs.oBtnTodayTitle="今天";  
  oCalendarChs.oBtnCancelTitle="取消";  
  oCalendarChs.oBtnClearTitle="清空";  
  oCalendarChs.Init();  
   
  function   PopupCalendar(InstanceName)  
  {  
  ///Global   Tag  
  this.instanceName=InstanceName;  
  ///Properties  
  this.separator="-";  
  this.oBtnTodayTitle="Today";  
  this.oBtnCancelTitle="Cancel";  
  this.weekDaySting=new   Array("S","M","T","W","T","F","S");  
  this.monthSting=new   Array("January","February","March","April","May","June","July","August","September","October","November","December");  
  this.Width=200;  
  this.currDate=new   Date();  
  this.today=new   Date();  
  this.startYear=this.currDate.getFullYear()   -   10;  
  this.endYear=this.currDate.getFullYear()   +   10;  
  ///Css  
  this.divBorderCss="1px   solid   #BCD0DE";  
  this.tableBorderColor="#CCCCCC"  
  ///Method  
  this.Init=CalendarInit;  
  this.Fill=CalendarFill;  
  this.Refresh=CalendarRefresh;  
  this.Restore=CalendarRestore;  
  ///HTMLObject  
  this.oTaget=null;  
  this.oPreviousCell=null;  
  this.sDIVID=InstanceName+"oDiv";  
  this.sTABLEID=InstanceName+"oTable";  
  this.sMONTHID=InstanceName+"oMonth";  
  this.sYEARID=InstanceName+"oYear";  
   
  }  
  function   CalendarInit() ///Create   panel  
  {  
  var   sMonth,sYear  
  sMonth=this.currDate.getMonth();  
  sYear=this.currDate.getFullYear();  
  htmlAll="<div   id='"+this.sDIVID+"'   style='display:none;position:absolute;width:"+this.Width+";border:"+this.divBorderCss+";padding:2px;background-color:#FFFFFF'>";  
  htmlAll+="<div   align='center'>";  
  ///   Month  
  htmloMonth="<select   id='"+this.sMONTHID+"'   onchange=CalendarMonthChange("+this.instanceName+")   style='width:50%'>";  
  for(i=0;i<12;i++)  
  {  
  htmloMonth+="<option   value='"+i+"'>"+this.monthSting[i]+"</option>";  
  }  
  htmloMonth+="</select>";  
  ///   Year  
  htmloYear="<select   id='"+this.sYEARID+"'   onchange=CalendarYearChange("+this.instanceName+")   style='width:50%'>";  
  for(i=this.startYear;i<=this.endYear;i++)  
  {  
  htmloYear+="<option   value='"+i+"'>"+i+"</option>";  
  }  
  htmloYear+="</select></div>";  
  ///   Day  
  htmloDayTable="<table   id='"+this.sTABLEID+"'   width='100%'   border=0   cellpadding=0   cellspacing=1   bgcolor='"+this.tableBorderColor+"'>";  
  htmloDayTable+="<tbody   bgcolor='#ffffff'style='font-size:13px'>";  
  for(i=0;i<=6;i++)  
  {  
  if(i==0)  
  htmloDayTable+="<tr   bgcolor='#98B8CD'>";  
  else  
  htmloDayTable+="<tr>";  
  for(j=0;j<7;j++)  
  {  
   
  if(i==0)  
  {  
  htmloDayTable+="<td   height='20'   align='center'   valign='middle'   style='cursor:hand'>";  
  htmloDayTable+=this.weekDaySting[j]+"</td>"  
  }  
  else  
  {  
  htmloDayTable+="<td   height='20'   align='center'   valign='middle'   style='cursor:hand'";  
  htmloDayTable+="   onmouseover=CalendarCellsMsOver(this,"+this.instanceName+")";  
  htmloDayTable+="   onmouseout=CalendarCellsMsOut(this)";  
  htmloDayTable+="   onclick=CalendarCellsClick(this,"+this.instanceName+")>";  
  htmloDayTable+="&nbsp;</td>"  
  }  
  }  
  htmloDayTable+="</tr>";  
  }  
  htmloDayTable+="</tbody></table>";  
  ///   Today   Button  
  htmloButton="<div   align='center'   style='padding:3px'>"  
  htmloButton+="<button   style='width:25%;border:1px   solid   #BCD0DE;background-color:#eeeeee;cursor:hand'"  
  htmloButton+="   onclick=CalendarTodayClick("+this.instanceName+")>"+this.oBtnTodayTitle+"</button>&nbsp;"  
  htmloButton+="<button   style='width:25%;border:1px   solid   #BCD0DE;background-color:#eeeeee;cursor:hand'"  
  htmloButton+="   onclick=CalendarCancel("+this.instanceName+")>"+this.oBtnCancelTitle+"</button>&nbsp;"  
  htmloButton+="<button   style='width:25%;border:1px   solid   #BCD0DE;background-color:#eeeeee;cursor:hand'"  
  htmloButton+="   onclick=CalendarClear("+this.instanceName+")>"+this.oBtnClearTitle+"</button>   "  
  htmloButton+="</div>"  
  ///   All  
  htmlAll=htmlAll+htmloMonth+htmloYear+htmloDayTable+htmloButton+"</div>";  
  document.write(htmlAll);  
  this.Fill();  
  }  
  function   CalendarFill() ///  
  {  
  var   sMonth,sYear,sWeekDay,sToday,oTable,currRow,MaxDay,sDaySn,sIndex,rowIndex,cellIndex,oSelectMonth,oSelectYear  
  sMonth=this.currDate.getMonth();  
  sYear=this.currDate.getFullYear();  
  sWeekDay=(new   Date(sYear,sMonth,1)).getDay();  
  sToday=this.currDate.getDate();  
  oTable=document.getElementById(this.sTABLEID);  
  currRow=oTable.rows[1];  
  MaxDay=CalendarGetMaxDay(sYear,sMonth);  
   
  oSelectMonth=document.getElementById(this.sMONTHID);  
  oSelectMonth.selectedIndex=sMonth;  
  oSelectYear=document.getElementById(this.sYEARID);  
  for(i=0;i<oSelectYear.length;i++)  
  {  
  if(parseInt(oSelectYear.options[i].value)==sYear)oSelectYear.selectedIndex=i;  
  }  
  ////  
  for(sDaySn=1,sIndex=sWeekDay;sIndex<=6;sDaySn++,sIndex++)  
  {  
   
  if(sDaySn==sToday)  
  {  
  currRow.cells[sIndex].innerHTML="<font   color=\"red\"><i><b>"+sDaySn+"</b></i></font>";  
  this.oPreviousCell=currRow.cells[sIndex];  
  }  
  else  
  {  
  currRow.cells[sIndex].innerHTML=sDaySn;  
  currRow.cells[sIndex].style.color="#666666";  
  }  
  CalendarCellSetCss(0,currRow.cells[sIndex]);  
  }  
  for(rowIndex=2;rowIndex<=6;rowIndex++)  
  {  
  if(sDaySn>MaxDay)break;  
  currRow=oTable.rows[rowIndex];  
  for(cellIndex=0;cellIndex<currRow.cells.length;cellIndex++)  
  {  
  if(sDaySn==sToday)  
  {  
  currRow.cells[cellIndex].innerHTML="<font   color=\"red\"><i><b>"+sDaySn+"</b></i></font>";  
  this.oPreviousCell=currRow.cells[cellIndex];  
  }  
  else  
  {  
  currRow.cells[cellIndex].innerHTML=sDaySn;  
  currRow.cells[cellIndex].style.color="#666666";  
  }  
  CalendarCellSetCss(0,currRow.cells[cellIndex]);  
  sDaySn++;  
  if(sDaySn>MaxDay)break;  
  }  
  }  
  }  
  Top

16 楼marxian(小玛仙)回复于 2006-04-12 14:33:12 得分 0

接上  
   
  ===========================  
   
  function   CalendarRestore() ///   Clear   Data  
  {  
  var   oTable  
  oTable=document.getElementById(this.sTABLEID);  
  for(i=1;i<oTable.rows.length;i++)  
  {  
  for(j=0;j<oTable.rows[i].cells.length;j++)  
  {  
  CalendarCellSetCss(0,oTable.rows[i].cells[j]);  
  oTable.rows[i].cells[j].innerHTML="&nbsp;";  
  }  
  }  
  }  
  function   CalendarRefresh(newDate) ///  
  {  
  this.currDate=newDate;  
  this.Restore();  
  this.Fill();  
  }  
  function   CalendarCellsMsOver(obj,oInstance) ///   Cell   MouseOver  
  {  
  var   myCell;  
  myCell=obj;//event.srcElement;  
  CalendarCellSetCss(0,oInstance.oPreviousCell);  
  if(myCell)  
  {  
  CalendarCellSetCss(1,myCell);  
  oInstance.oPreviousCell=myCell;  
  }  
  }  
  function   CalendarCellsMsOut(obj) //////   Cell   MouseOut  
  {  
           
  var   myCell;  
  myCell=obj;//event.srcElement;  
  CalendarCellSetCss(0,myCell);  
  }  
  function   CalendarCellsClick(oCell,oInstance)  
  {  
  var   sDay,sMonth,sYear,newDate;  
  sYear=oInstance.currDate.getFullYear();  
  sMonth=oInstance.currDate.getMonth();  
  sDay=oInstance.currDate.getDate();  
  var   str   =   oCell.innerHTML.toLowerCase().replace("\"","").replace("\"","");  
  if(str!="&nbsp;")  
  {  
          if(str.substring(0,22)=="<font   color=red><i><b>"){  
          str   =   str.substring(22,str.indexOf("</b></i></font>"));  
  }  
  sDay=parseInt(str);  
  if(sDay!=oInstance.currDate.getDate())  
  {  
  newDate=new   Date(sYear,sMonth,sDay);  
  oInstance.Refresh(newDate);  
  }  
  }  
  sDateString=sYear+oInstance.separator+CalendarDblNum(sMonth+1)+oInstance.separator+CalendarDblNum(sDay);  
   
  ///return   sDateString  
  if(oInstance.oTaget.tagName=="INPUT")  
  {  
  oInstance.oTaget.value=sDateString;  
  }  
  document.getElementById(oInstance.sDIVID).style.display="none";  
  }  
  function   CalendarYearChange(oInstance) ///   Year   Change  
  {  
  var   sDay,sMonth,sYear,newDate  
  sDay=oInstance.currDate.getDate();  
  sMonth=oInstance.currDate.getMonth();  
  sYear=document.getElementById(oInstance.sYEARID).value  
  newDate=new   Date(sYear,sMonth,sDay);  
  oInstance.Refresh(newDate);  
  }  
  function   CalendarMonthChange(oInstance) ///   Month   Change  
  {  
  var   sDay,sMonth,sYear,newDate  
  sDay=oInstance.currDate.getDate();  
  sMonth=document.getElementById(oInstance.sMONTHID).value  
  sYear=oInstance.currDate.getFullYear();  
  newDate=new   Date(sYear,sMonth,sDay);  
  oInstance.Refresh(newDate);  
  }  
  function   CalendarTodayClick(oInstance) ///   "Today"   button   Change  
  {  
  oInstance.Refresh(new   Date());  
  }  
  function   getDateString(oInputSrc,oInstance)  
  {  
  if(oInputSrc&&oInstance)    
  {  
  CalendarDiv=document.getElementById(oInstance.sDIVID);  
  oInstance.oTaget=oInputSrc;  
  //CalendarDiv.style.pixelLeft=CalendargetPos(oInputSrc,"Left");  
  //CalendarDiv.style.pixelTop=CalendargetPos(oInputSrc,"Top")+oInputSrc.offsetHeight;  
  CalendarDiv.style.left=CalendargetPos(oInputSrc,"Left")   +   "px";  
  CalendarDiv.style.top=CalendargetPos(oInputSrc,"Top")+oInputSrc.offsetHeight   +   "px";  
  CalendarDiv.style.display=(CalendarDiv.style.display=="none")?"":"none";  
  }  
  }  
  function   CalendarCellSetCss(sMode,oCell) ///   Set   Cell   Css  
  {  
  //   sMode  
  //   0:   OnMouserOut   1:   OnMouseOver    
  if(sMode)  
  {  
  oCell.style.border="1px   solid   #5589AA";  
  oCell.style.backgroundColor="#BCD0DE";  
  }  
  else  
  {  
  oCell.style.border="1px   solid   #FFFFFF";  
  oCell.style.backgroundColor="#FFFFFF";  
  }  
  }  
  function   CalendarGetMaxDay(nowYear,nowMonth) ///   Get   MaxDay   of   current   month  
  {  
  var   nextMonth,nextYear,currDate,nextDate,theMaxDay  
  nextMonth=nowMonth+1;  
  if(nextMonth>11)  
  {  
  nextYear=nowYear+1;  
  nextMonth=0;  
  }  
  else  
  {  
  nextYear=nowYear;  
  }  
  currDate=new   Date(nowYear,nowMonth,1);  
  nextDate=new   Date(nextYear,nextMonth,1);  
  theMaxDay=(nextDate-currDate)/(24*60*60*1000);  
  return   theMaxDay;  
  }  
  function   CalendargetPos(el,ePro) ///   Get   Absolute   Position  
  {  
  var   ePos=0;  
  while(el!=null)  
  {  
  ePos+=el["offset"+ePro];  
  el=el.offsetParent;  
  }  
  return   ePos;  
  }  
  function   CalendarDblNum(num)  
  {  
  if(num<10)    
  return   "0"+   num;  
  else  
  return   num;  
  }  
  function   CalendarCancel(oInstance) ///Cancel  
  {  
  CalendarDiv=document.getElementById(oInstance.sDIVID);  
  CalendarDiv.style.display="none";  
  }  
  function   CalendarClear(oInstance) ///Clear  
  {  
          oInstance.oTaget.value   =   "";  
  CalendarDiv=document.getElementById(oInstance.sDIVID);  
  CalendarDiv.style.display="none";  
  }Top

17 楼wxcyz(阿图)回复于 2006-04-13 16:18:40 得分 5

http://www.twhs.com.tw/js/calendar.js  
   
   
  <input   type="text"   name="name"   size="15"   onFocus="setday(this)">  
   
   
  Top

18 楼Radar2006(中华英雄)回复于 2006-04-14 00:02:37 得分 10

C#的日期选择控件:  
  -------------------------------  
  DataSel.ascx  
  -------------------------------  
  <%@   Control   Language="c#"   AutoEventWireup="false"   Codebehind="DataSel.ascx.cs"   Inherits="CommonFunction.DataSel"   TargetSchema="http://schemas.microsoft.com/intellisense/ie5"   %>  
  <asp:panel   id="panlCalendar"   Width="296px"   Height="192px"   runat="server"   style="Z-INDEX:   101;   LEFT:   0px;   POSITION:   absolute;   TOP:   0px">  
  <TABLE   id="Table1"   style="WIDTH:   296px;   HEIGHT:   214px"   cellSpacing="1"   cellPadding="1"  
  width="296"   border="0">  
  <TR>  
  <TD   id="btnYear"   align="center"   bgColor="silver">  
  <asp:LinkButton   id="btnYear"   runat="server"   ToolTip="转到指定的年份"   CausesValidation="False"   Font-Bold="True"  
  ForeColor="White"   Font-Size="Smaller">转到</asp:LinkButton>  
  <asp:TextBox   id="txtYear"   runat="server"></asp:TextBox><FONT   color="#ffffff"   size="2"><STRONG>年</STRONG></FONT>  
  </FONT></TD>  
  </TR>  
  <TR>  
  <TD   vAlign="top">  
  <asp:Calendar   id="dataCal"   runat="server"   Height="164px"   Width="305px"   BackColor="White"   BorderColor="Black"  
  BorderStyle="Solid"   NextMonthText="下一月"   PrevMonthText="上一月">  
  <TodayDayStyle   BackColor="#FFFFC0"></TodayDayStyle>  
  <DayStyle   Font-Size="8pt"   Font-Names="Arial"></DayStyle>  
  <DayHeaderStyle   Font-Size="10pt"   Font-Underline="True"   Font-Names="Arial"   BorderStyle="None"   BackColor="#E0E0E0"></DayHeaderStyle>  
  <SelectedDayStyle   Font-Size="8pt"   Font-Names="Arial"   Font-Bold="True"   ForeColor="White"   BackColor="Navy"></SelectedDayStyle>  
  <TitleStyle   Font-Size="10pt"   Font-Names="Arial"   Font-Bold="True"   ForeColor="White"   BackColor="LightSeaGreen"></TitleStyle>  
  <OtherMonthDayStyle   ForeColor="Gray"></OtherMonthDayStyle>  
  </asp:Calendar></TD>  
  </TR>  
  </TABLE>  
  </asp:panel>  
  Top

19 楼Radar2006(中华英雄)回复于 2006-04-14 00:03:40 得分 0

C#的日期选择控件2:  
  -------------------------------  
  DataSel.ascx.cs  
  -------------------------------  
  namespace   CommonFunction  
  {  
  using   System;  
  using   System.Data;