CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  JavaScript

请问哪位有选择日期的代码

楼主atu8000(阿土)2004-12-02 21:37:14 在 Web 开发 / JavaScript 提问

就像现在网页上的万年历一样,点击一个日期后在本页面上的两个text中分别返回阳历和阴历 问题点数:0、回复次数:4Top

1 楼net_lover(【孟子E章】)回复于 2004-12-02 22:01:25 得分 0

http://dev.csdn.net/article/38/38464.shtmTop

2 楼dachangtui(大长腿)回复于 2004-12-02 22:41:13 得分 0

学习了Top

3 楼atu8000(阿土)回复于 2004-12-22 10:04:34 得分 0

我想要有返回值的Top

4 楼pringlesgirl(病榻看雪)回复于 2004-12-24 15:29:48 得分 0

本人用的    
  <!--  
  Function   Name       :   日期選擇程式  
  Desc                         :    
  Create   By               :   Mabel   Deng    
  Date                         :   04/12/03  
  Modify   By               :    
  Last   Modify   Date:    
  -->  
  <html>  
  <head>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=big5">  
  <title><%=myTitle%></title>  
  </head>  
  <body   leftmargin="0"   topmargin="0"   rightmargin="0"   bottommargin="0">  
  <%  
  '*******************************************************  
  '*   ASP   101   Sample   Code   -   http://www.asp101.com   *  
  '*   *  
  '*   This   code   is   made   available   as   a   service   to   our   *  
  '*   visitors   and   is   provided   strictly   for   the   *  
  '*   purpose   of   illustration.   *  
  '*   *  
  '*   Please   direct   all   inquiries   to   webmaster@asp101.com   *  
  '*******************************************************  
  %>    
   
  <%  
  '   ***Begin   Function   Declaration***  
  '   New   and   improved   GetDaysInMonth   implementation.  
  '   Thanks   to   Florent   Renucci   for   pointing   out   that   I  
  '   could   easily   use   the   same   method   I   used   for   the  
  '   revised   GetWeekdayMonthStartsOn   function.  
  Function   GetDaysInMonth(iMonth,   iYear)  
  Dim   dTemp  
  dTemp   =   DateAdd("d",   -1,   DateSerial(iYear,   iMonth   +   1,   1))  
  GetDaysInMonth   =   Day(dTemp)  
  End   Function  
   
  '   Previous   implementation   on   GetDaysInMonth  
  'Function   GetDaysInMonth(iMonth,   iYear)  
  '   Select   Case   iMonth  
  '   Case   1,   3,   5,   7,   8,   10,   12  
  '   GetDaysInMonth   =   31  
  '   Case   4,   6,   9,   11  
  '   GetDaysInMonth   =   30  
  '   Case   2  
  '   If   IsDate("February   29,   "   &   iYear)   Then  
  '   GetDaysInMonth   =   29  
  '   Else  
  '   GetDaysInMonth   =   28  
  '   End   If  
  '   End   Select  
  'End   Function  
   
  Function   GetWeekdayMonthStartsOn(dAnyDayInTheMonth)  
  Dim   dTemp  
  dTemp   =   DateAdd("d",   -(Day(dAnyDayInTheMonth)   -   1),   dAnyDayInTheMonth)  
  GetWeekdayMonthStartsOn   =   WeekDay(dTemp)  
  End   Function  
   
  Function   SubtractOneMonth(dDate)  
  SubtractOneMonth   =   DateAdd("m",   -1,   dDate)  
  End   Function  
   
  Function   AddOneMonth(dDate)  
  AddOneMonth   =   DateAdd("m",   1,   dDate)  
  End   Function  
  '   ***End   Function   Declaration***  
   
   
  Dim   dDate   '   Date   we're   displaying   calendar   for  
  Dim   iDIM   '   Days   In   Month  
  Dim   iDOW   '   Day   Of   Week   that   month   starts   on  
  Dim   iCurrent   '   Variable   we   use   to   hold   current   day   of   month   as   we   write   table  
  Dim   iPosition   '   Variable   we   use   to   hold   current   position   in   table  
   
   
  '   Get   selected   date.   There   are   two   ways   to   do   this.  
  '   First   check   if   we   were   passed   a   full   date   in   RQS("date").  
  '   If   so   use   it,   if   not   look   for   seperate   variables,   putting   them   togeter   into   a   date.  
  '   Lastly   check   if   the   date   is   valid...if   not   use   today  
  If   IsDate(Request.QueryString("date"))   Then  
  dDate   =   CDate(Request.QueryString("date"))  
  Else  
  If   IsDate(Request.QueryString("month")   &   "-"   &   Request.QueryString("day")   &   "-"   &   Request.QueryString("year"))   Then  
  dDate   =   CDate(Request.QueryString("month")   &   "-"   &   Request.QueryString("day")   &   "-"   &   Request.QueryString("year"))  
  Else  
  dDate   =   Date()  
  '   The   annoyingly   bad   solution   for   those   of   you   running   IIS3  
  If   Len(Request.QueryString("month"))   <>   0   Or   Len(Request.QueryString("day"))   <>   0   Or   Len(Request.QueryString("year"))   <>   0   Or   Len(Request.QueryString("date"))   <>   0   Then  
  Response.Write   "The   date   you   picked   was   not   a   valid   date.   The   calendar   was   set   to   today's   date.<BR><BR>"  
  End   If  
  '   The   elegant   solution   for   those   of   you   running   IIS4  
  'If   Request.QueryString.Count   <>   0   Then   Response.Write   "The   date   you   picked   was   not   a   valid   date.   The   calendar   was   set   to   today's   date.<BR><BR>"  
  End   If  
  End   If  
   
  'Now   we've   got   the   date.   Now   get   Days   in   the   choosen   month   and   the   day   of   the   week   it   starts   on.  
  iDIM   =   GetDaysInMonth(Month(dDate),   Year(dDate))  
  iDOW   =   GetWeekdayMonthStartsOn(dDate)  
   
  %>  
  <!--   Outer   Table   is   simply   to   get   the   pretty   border-->  
  <TABLE   BORDER=10   CELLSPACING=0   CELLPADDING=0   bordercolor="#9999cc">  
  <TR>  
  <TD>  
  <TABLE   BORDER=1   CELLSPACING=0   CELLPADDING=1   BGCOLOR=#BDE4B7   bordercolor="#cdeac9">  
  <TR>  
  <TD   BGCOLOR="#f0f0f0"   ALIGN="center"   COLSPAN=7>  
  <TABLE   WIDTH=100%   BORDER=0   CELLSPACING=0   CELLPADDING=0>  
  <TR>  
  <TD   ALIGN="right"><A   HREF="<%=targetAsp%>?date=<%=SubtractOneMonth(dDate)   %>"><FONT   COLOR=#F05E17   SIZE="-1"><<</FONT></A></TD>  
  <TD   ALIGN="center"><FONT   COLOR=#F05E17><B><%=MonthName(Month(dDate))   &   "   "   &   Year(dDate)   %></B></FONT></TD>  
  <TD   ALIGN="left"><A   HREF="<%=targetAsp%>?date=<%=AddOneMonth(dDate)   %>"><FONT   COLOR=#F05E17   SIZE="-1">>></FONT></A></TD>  
  </TR>  
  </TABLE>  
  </TD>  
  </TR>  
  <TR   BGCOLOR   =#CFD23E>  
  <TD   ALIGN="center"><FONT   COLOR=#F05E17><B>Sun</B></FONT><BR><IMG    
  SRC="./images/spacer.gif"   WIDTH=30   HEIGHT=1   BORDER=0></TD>  
  <TD   ALIGN="center"><FONT   COLOR=#F05E17><B>Mon</B></FONT><BR><IMG    
  SRC="./images/spacer.gif"   WIDTH=30   HEIGHT=1   BORDER=0></TD>  
  <TD   ALIGN="center"><FONT   COLOR=#F05E17><B>Tue</B></FONT><BR><IMG    
  SRC="./images/spacer.gif"   WIDTH=30   HEIGHT=1   BORDER=0></TD>  
  <TD   ALIGN="center"><FONT   COLOR=#F05E17><B>Wed</B></FONT><BR><IMG    
  SRC="./images/spacer.gif"   WIDTH=30   HEIGHT=1   BORDER=0></TD>  
  <TD   ALIGN="center"><FONT   COLOR=#F05E17><B>Thu</B></FONT><BR><IMG    
  SRC="./images/spacer.gif"   WIDTH=30   HEIGHT=1   BORDER=0></TD>  
  <TD   ALIGN="center"><FONT   COLOR=#F05E17><B>Fri</B></FONT><BR><IMG    
  SRC="./images/spacer.gif"   WIDTH=30   HEIGHT=1   BORDER=0></TD>  
  <TD   ALIGN="center"><FONT   COLOR=#F05E17><B>Sat</B></FONT><BR><IMG    
  SRC="./images/spacer.gif"   WIDTH=30   HEIGHT=1   BORDER=0></TD>  
  </TR>  
  <%  
  '   Write   spacer   cells   at   beginning   of   first   row   if   month   doesn't   start   on   a   Sunday.  
  If   iDOW   <>   1   Then  
  Response.Write   vbTab   &   "<TR>"   &   vbCrLf  
  iPosition   =   1  
  Do   While   iPosition   <   iDOW  
  Response.Write   vbTab   &   vbTab   &   "<TD>   </TD>"   &   vbCrLf  
  iPosition   =   iPosition   +   1  
  Loop  
  End   If  
   
  '   Write   days   of   month   in   proper   day   slots  
  iCurrent   =   1  
  iPosition   =   iDOW  
  Do   While   iCurrent   <=   iDIM  
  '   If   we're   at   the   begginning   of   a   row   then   write   TR  
  If   iPosition   =   1   Then  
  Response.Write   vbTab   &   "<TR   HEIGHT=""1"">"   &   vbCrLf  
  End   If  
   
  '   If   the   day   we're   writing   is   the   selected   day   then   highlight   it   somehow.  
  dim   fmtDate    
  fmtDate   =   Year(dDate)   &   "/"  
  if   Cint(Month(dDate))     <   10   then  
  fmtDate   =   fmtDate   &   "0"   &   Month(dDate)   &   "/"  
  else  
  fmtDate   =   fmtDate   &   Month(dDate)   &   "/"  
  end   if  
  if   Cint(iCurrent)   <   10   then    
  fmtDate   =   fmtDate   &   "0"   &   cstr(iCurrent)      
  else  
  fmtDate   =   fmtDate   &   cstr(iCurrent)      
  end   if  
  If   iCurrent   =   Day(dDate)   Then  
  Response.Write   vbTab   &   vbTab   &   "<TD   BGCOLOR=#00FFFF><A   HREF=""javascript:RetVal('"&   fmtDate   &"');""><FONT   SIZE=""-1""   style=""text-align:center""><B>"   &   iCurrent   &   "</B></FONT><BR><BR><IMG   SRC=""./images/spacer.gif""   WIDTH=30   HEIGHT=1   BORDER=0></TD>"   &   vbCrLf  
  Else  
  Response.Write   vbTab   &   vbTab   &   "<TD><A   HREF=""javascript:RetVal('"&   fmtDate   &"');""><FONT   SIZE=""-1""   style=""text-align:center"">"   &   iCurrent   &   "</FONT></A><BR><BR><IMG   SRC=""./images/spacer.gif""   WIDTH=30   HEIGHT=1   BORDER=0></TD>"   &   vbCrLf  
  End   If  
   
  '   If   we're   at   the   endof   a   row   then   write   /TR  
  If   iPosition   =   7   Then  
  Response.Write   vbTab   &   "</TR>"   &   vbCrLf  
  iPosition   =   0  
  End   If  
   
  '   Increment   variables  
  iCurrent   =   iCurrent   +   1  
  iPosition   =   iPosition   +   1  
  Loop  
   
  '   Write   spacer   cells   at   end   of   last   row   if   month   doesn't   end   on   a   Saturday.  
  If   iPosition   <>   1   Then  
  Do   While   iPosition   <=   7  
  Response.Write   vbTab   &   vbTab   &   "<TD>   </TD>"   &   vbCrLf  
  iPosition   =   iPosition   +   1  
  Loop  
  Response.Write   vbTab   &   "</TR>"   &   vbCrLf  
  End   If  
  %>  
  </TABLE>  
  </TD>  
  </TR>  
  </TABLE>  
  <BR>  
  <TABLE   BORDER=0   CELLSPACING=0   CELLPADDING=0><TR><TD   ALIGN="center">  
  <FORM   ACTION="<%=targetAsp%>"   METHOD=post></FORM>  
  </TD></TR></TABLE>  
  </body>  
  </html>  
   
  Top

相关问题

  • 求高人改一段代码,日期选择类的
  • 谁有好的选择日期的代码?~~下拉式选择那种~~
  • 请问谁有一个关于“日期”选择的控件代码?
  • 以下代码是表单选择日期控件,一加form提交,这个日期控件就会没用???
  • 求:点击输入框出现日历菜单可以选择日期并作为input值的代码
  • 求asp中关于日期选择源代码,100分高分在线等!!!急!!急!!
  • 原创控件代码共享--日期选择控件+同时祝贺爱人生日+来者有分
  • 200分 恳求大家给我提供一个 既能选择日期,又能选择时间(精确到分)得控件或代码
  • !!!日期选择器!!!
  • 如何选择日期?

关键词

  • date
  • iposition
  • vbcrlfiposition
  • icurrent
  • ddate
  • vbcrlfend
  • vbtab
  • thenresponse
  • querystring
  • day

得分解答快速导航

  • 帖主:atu8000

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo