主要是农历算法嘛!参照date和dateformat类来写

解决方案 »

  1.   

    String Format_Date(Calendar cal){
    return cal.get(Calendar.YEAR)
    +"/"+(cal.get(Calendar.MONTH)+1)
    +"/"+cal.get(Calendar.DATE);
    }String Format_Date8(Calendar cal){
    String m = "00"+(cal.get(Calendar.MONTH)+1);
    String d = "00"+cal.get(Calendar.DATE);
    return cal.get(Calendar.YEAR)
    +m.substring(m.length()-1)
    +d.substring(d.length()-1);
    }String Format_LongDate(Calendar cal){
    return cal.get(Calendar.YEAR)+"year "
    +(cal.get(Calendar.MONTH)+1)+"mon "
    +cal.get(Calendar.DATE)+"day";
    }Calendar Get_FirstSunday(Calendar cal){
    Calendar cal1 = Calendar.getInstance();
    cal1.set(cal.get(Calendar.YEAR)
    ,cal.get(Calendar.MONTH)
    ,1);
    Calendar calret = Calendar.getInstance();
    calret.set(cal1.get(Calendar.YEAR)
    ,cal1.get(Calendar.MONTH)
    ,1-(cal1.get(Calendar.DAY_OF_WEEK)-1));
    return calret;
    }int Get_WeekCount(Calendar cal){
    Calendar cal1 = Get_FirstSunday(cal);
    Calendar cal2 = Calendar.getInstance();
    cal2.set(cal.get(Calendar.YEAR)
    ,cal.get(Calendar.MONTH)+1
    ,0);
    return (int)Math.floor(Get_Datediff(cal1, cal2)/7)+1;
    }
    int Get_Datediff(Calendar cal1, Calendar cal2){
    long lng1 = (cal1.getTime()).getTime();
    long lng2 = (cal2.getTime()).getTime();
    return (int)Math.floor((lng2-lng1)/(1000*60*60*24));
    }
      

  2.   

    小弟我正好做了一个完整的,分几段给你
    1 段:
    <%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
    <%@ page import="java.util.Calendar"%>
    <%@ page import="java.util.Date" %>
    <%@ page import="java.sql.*"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>日历</title>
    <link href="../lib/LOGIN.css" rel="stylesheet" type="text/css">
    <script src="/lib/jsfunc.js"></script>
    <script src="showTitle.js"></script>
    <style type="text/css">
    <!--
    -->
    </style>
    <style type="text/css">
    <!--
    .lzbk {
    border: 1px ridge #dcdcdc;
    }
    -->
    </style>
    <style type="text/css">
    <!--
    .caltab {
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-color: #efefef;
    border-right-color: #666666;
    border-bottom-color: #666666;
    border-left-color: #efefef;
    }
    -->
    </style>
    </HEAD>
    <BODY topMargin=0 onload=k=0;clockon();><%//变量 
    Date now_date=null;
    int now_date_year=0;
    int now_date_month=0;
    int now_date_date=0;int now_date_hours=0;//小时
    int now_date_minutes=0;//分
    int now_date_seconds=0;//秒Date today=new Date();
    int today_year=0;
    int today_month=0;
    int today_date=0;
    int today_day=0;
    String today_day_s="";
     %>
    <% //变换日期,接受变换变量
    if(request.getParameter("SY")!=null && request.getParameter("SM")!=null){
    now_date_year=Integer.parseInt(request.getParameter("SY"));
    now_date_month=Integer.parseInt(request.getParameter("SM"));
    now_date=new Date();//现在日期时间
     now_date_hours=now_date.getHours();//小时
     now_date_minutes=now_date.getMinutes();//分
     now_date_seconds=now_date.getSeconds();//秒
    %><%/////第一次访问本页初始化时间 
    }
    else{
    /////////取得服务器现在日期时间
    now_date=new Date();//现在日期时间
    now_date_year=now_date.getYear()+1900;//年
    now_date_month=now_date.getMonth()+1;//月
    now_date_date=now_date.getDate();//日
     now_date_hours=now_date.getHours();//小时
     now_date_minutes=now_date.getMinutes();//分
     now_date_seconds=now_date.getSeconds();//秒
    /*Date now_date=new Date();//现在日期时间
    int now_date_year=now_date.getYear()+1900;//年
    int now_date_month=now_date.getMonth()+1;//月
    int now_date_date=now_date.getDate();//日
    int now_date_day=now_date.getDay();//星期几
    int now_date_hours=now_date.getHours();//小时
    int now_date_minutes=now_date.getMinutes();//分
    int now_date_seconds=now_date.getSeconds();//秒
    */
    }
    today_year=today.getYear()+1900;;
    today_month=today.getMonth()+1;;
    today_date=today.getDate();
    today_day=today.getDay(); switch(today_day){
     case 1:
      today_day_s="一";
     break;
     case 2:
      today_day_s="二";
     break;
     case 3:
      today_day_s="三";
     break;
     case 4:
      today_day_s="四";
     break;
     case 5:
      today_day_s="五";
     break;
     case 6:
      today_day_s="<font color='#FF0000' size='4'>六</font>";
     break;
     case 0:
      today_day_s="<font color='#FF0000' size='4'>日</font>";
     break;
     }
    %>
    <script language="JavaScript" type="text/JavaScript">
    var tD=<%= now_date_date %>;
    </script>
    <script>
    //////////////////////计算
    var lzSD=new Array(42);
    var lunarInfo=new Array(
    0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
    0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,
    0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,
    0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,
    0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,
    0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,
    0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,
    0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6,
    0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,
    0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,
    0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,
    0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,
    0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,
    0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,
    0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)var solarMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    var Gan=new Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸");
    var Zhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
    var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");
    var solarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至")
    var sTermInfo = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758)
    var nStr1 = new Array('日','一','二','三','四','五','六','七','八','九','十')
    var nStr2 = new Array('初','十','廿','卅',' ')
    var monthName = new Array("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC");
    var sFtv = new Array(
    "0101*元旦",
    "0214 情人节",
    "0308 妇女节",
    "0312 植树节",
    "0315 消费者权益日",
    "0401 愚人节",
    "0501 劳动节",
    "0504 青年节",
    "0512 护士节",
    "0601 儿童节",
    "0701 建党节 香港回归纪念",
    "0718 托普诞辰",
    "0801 建军节",
    "0808 父亲节",
    "0909 毛泽东逝世纪念",
    "0910 教师节",
    "0928 孔子诞辰",
    "1001*国庆节",
    "1006 老人节",
    "1024 联合国日",
    "1030 数学公园建站纪念日",
    "1112 孙中山诞辰纪念",
    "1220 澳门回归纪念",
    "1226 毛泽东诞辰纪念")
    var lFtv = new Array(
    "0101*春节",
    "0115 元宵节",
    // lz  3-10 "0218 母亲生日",
    "0505 端午节",
    "0707 七夕情人节",
    "0713 中元节",
    //"0807 朱绍聪生日",
    "0815 中秋节",
    //"0822 詹正飞生日",
    "0909 重阳节",
    //"1007 朱启栋生日",
    "1108 父亲生日",
    //"1120 朱华英生日",
    //"1123 小莉的生日",
    //"1205 朱绍兴生日",
    //"1212 朱旭东生日",
    "1224 小年",
    //"1227 朱绍飞生日",
    "1230*除夕")
    var wFtv = new Array(
      

  3.   

    第2段:
    //"0131 Martin Luther King Day",
    //"0231 President's Day",
    //"0520 母亲节",
    //"0530 Armed Forces Day"
    //"0531 Victoria Day",
    "0716 合作节",
    "0730 被奴役国家周"
    //"0811 Civic Holiday",
    //"0911 Labor Holiday",
    //"1021 Columbus Day",
    //"1144 Thanksgiving"
    )//====================================== 传回农历 y年的总天数
    function lYearDays(y) {
       var i, sum = 348
       for(i=0x8000; i>0x8; i>>=1) sum += (lunarInfo[y-1900] & i)? 1: 0
       return(sum+leapDays(y))
    }//====================================== 传回农历 y年闰月的天数
    function leapDays(y) {
       if(leapMonth(y))  return((lunarInfo[y-1900] & 0x10000)? 30: 29)
       else return(0)
    }//====================================== 传回农历 y年闰哪个月 1-12 , 没闰传回 0
    function leapMonth(y) {
       return(lunarInfo[y-1900] & 0xf)
    }//====================================== 传回农历 y年m月的总天数
    function monthDays(y,m) {
       return( (lunarInfo[y-1900] & (0x10000>>m))? 30: 29 )
    }
    //====================================== 算出农历, 传入日期物件, 传回农历日期物件
    //                                       属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl
    function Lunar(objDate) {   var i, leap=0, temp=0
       var baseDate = new Date(1900,0,31)
       var offset   = (objDate - baseDate)/86400000   this.dayCyl = offset + 40
       this.monCyl = 14   for(i=1900; i<2050 && offset>0; i++) {
          temp = lYearDays(i)
          offset -= temp
          this.monCyl += 12
       }   if(offset<0) {
          offset += temp;
          i--;
          this.monCyl -= 12
       }   this.year = i
       this.yearCyl = i-1864   leap = leapMonth(i) 
       this.isLeap = false   for(i=1; i<13 && offset>0; i++) {
          
          if(leap>0 && i==(leap+1) && this.isLeap==false)
             { --i; this.isLeap = true; temp = leapDays(this.year); }
          else
             { temp = monthDays(this.year, i); }     
          if(this.isLeap==true && i==(leap+1)) this.isLeap = false      offset -= temp
          if(this.isLeap == false) this.monCyl ++
       }   if(offset==0 && leap>0 && i==leap+1)
          if(this.isLeap)
             { this.isLeap = false; }
          else
             { this.isLeap = true; --i; --this.monCyl;}   if(offset<0){ offset += temp; --i; --this.monCyl; }   this.month = i
       this.day = offset + 1
    }//==============================传回公历 y年某m+1月的天数
    function solarDays(y,m) {
       if(m==1)
          return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28)
       else
          return(solarMonth[m])
    }//============================== 传入 offset 传回干支, 0=甲子
    function cyclical(num) {
       return(Gan[num%10]+Zhi[num%12])
    }
    //============================== 月历属性
    function calElement(sYear,sMonth,sDay,week,lYear,lMonth,lDay,isLeap,cYear,cMonth,cDay) {      this.isToday    = false;
          this.sYear      = sYear;
          this.sMonth     = sMonth;
          this.sDay       = sDay;
          this.week       = week;
          this.lYear      = lYear;
          this.lMonth     = lMonth;
          this.lDay       = lDay;
          this.isLeap     = isLeap;
          this.cYear      = cYear;
          this.cMonth     = cMonth;
          this.cDay       = cDay;      this.color      = '';      this.lunarFestival = ''; //农历节日
          this.solarFestival = ''; //国历节日
          this.solarTerms    = ''; //节气}
      

  4.   

    第4段:
    <script>
    function lzbig_DAY(){
     lzlObj=eval('lzDAY');
     
     lzcld=new calendar(<%= today_year %>,<%= today_month-1 %>);
      //if(lzcld[<%= today_date-1 %>].lDay==1) 
                 //lzlObj.innerHTML='<b>'+(lzcld[<%= today_date-1 %>].isLeap?'闰':'') + lzcld[<%= today_date-1 %>].lMonth + '月' + (monthDays(lzcld[<%= today_date-1 %>].lYear,lzcld[<%= today_date-1 %>].lMonth)==29?'小':'大')+'</b>';
      //else 
                 lzlObj.innerHTML=(lzcld[<%= today_date-1 %>].isLeap?'闰':'') + lzcld[<%= today_date-1 %>].lMonth + '月' + (monthDays(lzcld[<%= today_date-1 %>].lYear,lzcld[<%= today_date-1 %>].lMonth)==29?'小':'大')+'<br><br>'+cDay(lzcld[<%= today_date-1 %>].lDay);
     
    lzs=lzcld[<%= today_date-1 %>].lunarFestival;
             if(lzs.length>0) { 
                if(lzs.length>6) lzs = lzs.substr(0, 4)+'…';
                lzs = lzs.fontcolor('red');
             }
             else { //国历节日
                lzs=lzcld[<%= today_date-1 %>].solarFestival;
                if(lzs.length>0) {
                   size = (lzs.charCodeAt(0)>0 && lzs.charCodeAt(0)<128)?8:4;
                   if(lzs.length>size+2) lzs = lzs.substr(0, size)+'…';
                   lzs = lzs.fontcolor('blue');
                }
                else { //廿四节气
                   lzs=lzcld[<%= today_date-1 %>].solarTerms;
                   if(lzs.length>0) lzs = lzs.fontcolor('limegreen');
                }
             }
              if(lzs.length>0) lzlObj.innerHTML = lzs;
    }
    </script><script>
    function changeCld() {
       var y,m;
       y=<%= now_date_year %>;
       m=<%= now_date_month %>;
       drawCld(y,m);
       document.CLD.submit();
    }
    </script>
    <SCRIPT language=javaScript>function clockon() {
    if (k==0){  FirstTime= new Date()
      ST='Friday, March 07, <%= now_date_year %> <%= now_date_hours %>:<%= now_date_minutes %>:<%= now_date_seconds %>';
      ServerTime=new Date(ST)
      H=ServerTime.getHours();
      M=ServerTime.getMinutes();
      S=ServerTime.getSeconds();
      D=ServerTime.getDate();
      Mo=ServerTime.getMonth()+1;
      Y=ServerTime.getYear();
      
      H1=FirstTime.getHours();
      M1=FirstTime.getMinutes();
      S1=FirstTime.getSeconds();
      D1=FirstTime.getDate();
      Mo1=FirstTime.getMonth()+1;
      Y1=FirstTime.getYear();  H2=H-H1
      M2=M-M1
      S2=S-S1
      D2=D-D1
      Mo2=Mo-Mo1
      Y2=Y-Y1
    }k=k+1thistime= new Date()
    H3=thistime.getHours();
    M3=thistime.getMinutes();
    S3=thistime.getSeconds();
    D3=thistime.getDate();
    Mo3=thistime.getMonth()+1;
    Y3=thistime.getYear();
    thistime=new Date(Y3+Y2,Mo3+Mo2,D3+D2,H3+H2,M3+M2,S3+S2)
    var hours=thistime.getHours()
    var minutes=thistime.getMinutes()
    var seconds=thistime.getSeconds()if (eval(hours) <10) {hours="0"+hours}
    if (eval(minutes) < 10) {minutes="0"+minutes}
    if (seconds < 10) {seconds="0"+seconds}
    thistime = hours+":"+minutes+":"+seconds
    if(document.all) {
    //bgclocknoshade.innerHTML=thistime
    bgclockshade.innerHTML=thistime
    }
    var timer=setTimeout("clockon()",1000)
    }</SCRIPT><br>
    <font color="666666"><strong>&nbsp; [日程安排]</strong></font> 
    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr> 
        <td width="25%" align="left" valign="top"> <table width="99%" height="240" border="0" align="left" cellpadding="0" cellspacing="0" class="sec-bk1">
            <tr> 
              <td> <div align="center"> 
                  <p><font color="#990000" size="6"><strong>今天</strong></font> <br>
                    <strong><font size="4">公元 <%= today_year %>年 <%= today_month %>月</font></strong><br>
                    <font color=#000000 face=宋体 id=lzGZ size=2></font> <font color=#000000 face=宋体 id=lzDAY  size=2></font><br>
                    <strong><font size="+4"><%= today_date %></font></strong> <br>
                    <strong><font color="F" size="4">星期</font><font size="4"><%= today_day_s %></font></strong></p>
                  <font color="#FF0000" size="3" id=bgclockshade></font> </div></td>
            </tr>
            <tr> 
              <td height="7"></td>
            </tr>
          </table></td>
        <td width="75%" align="center"> <table width="100%" border="0" cellpadding="0" cellspacing="0" >
            <tr> 
              <td align="right"> <table width="99%" height=27 border="1" cellpadding="0" cellspacing="0"  bordercolor="#dcdcdc" bordercolorlight="#dcdcdc" bordercolordark="#FFFFFF" class="caltab"  >
                  <tr> 
                    <form action="" method="post" name=CLD>
                      <td height=24 colspan=7 bgcolor="#ffcc00"> <div align="center"><font color="#000000">转到:年</font> 
                          <select name=SY 
                            onChange=changeCld() style="FONT-SIZE: 9pt">
                            <script language=JavaScript><!--  
                for(i=1900;i<2050;i++) {
    document.write('<option value="'+i+'">'+i)  ;
    document.write('</option>');
    }
                //--></script>
                          </select>
                          <font color="#000000">月</font> 
                          <select name=SM 
                            onChange=changeCld() style="FONT-SIZE: 9pt">
                            <script language=JavaScript><!--  
                for(i=1;i<13;i++) {
    document.write('<option value="'+i+'">'+i)  ;
    document.write('</option>');
    }
                //--></script>
                          </select>
                          <font 
                      color=#000000 face=宋体 id=GZ size=2>&nbsp;</font></div></td>
                    </form>
                  </tr>
                  <tr align=middle > 
                    <td height=1 colspan="7"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#fffcda">
                        <tr align="center" bgcolor="#efefef"> 
                          <td width="16%"> 日</td>
                          <td> 一</td>
                          <td> 二</td>
                          <td> 三</td>
                          <td> 四</td>
                          <td> 五</td>
                          <td> 六</td>
                        </tr>
                      </table></td>
                  </tr>
                  <tr align=middle> 
                    <td width=16% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                  </tr>
                  <% 
      int gNum=0;
      for(int i=0; i<6;i++){
      out.print("<tr>");
         for(int j=0;j<7;j++){
     gNum=i*7+j;
     %>
                  <script>
     var lzsw=new Array(42);
    function lzsent(lzgNum){
    //alert(lzSD[lzgNum]);
    //main.opener.location='sec_arrange_add.jsp?today='+lzSD[lzgNum];
    var y,m;
       y=CLD.SY.options.selectedIndex+1900;
       m=CLD.SM.options.selectedIndex+1;document.location='sec_arrange_add.jsp?today='+lzSD[lzgNum]+'&year='+y+'&month='+m; 
    //document.CLD.submit();
    //return lzSD[lzgNum];
    //lzsw[lzgNum]=lzSD[lzgNum];
    }</script>
                  <td bgcolor="#FfFFF7" id="GD<%= gNum %>" onDblClick = "lzsent(<%= gNum %>)" title="双击鼠标添加当日日程" name= "GD<%= gNum %>"> 
                    <font id="SD<%= gNum %>"  size=2 face="Arial Black">&nbsp; </font> 
                    <br> <font id="LD<%= gNum %>" size=2 style="font-size:9pt">&nbsp; 
                    </font> <a id="SHOW<%= gNum %>" align=right> </a> </td>
                  <%
     }
     out.print("</tr>");
      }
       %>
                </table></td>
            </tr>
            <tr> 
              <td height="7"></td>
            </tr>
          </table></td>
      </tr>
    </table>
    <script>
    //////设置年月
    lzbig_DAY();
    CLD.SY.selectedIndex=<%= now_date_year %>;
    CLD.SY.value=<%= now_date_year %>;
    CLD.SM.selectedIndex=<%= now_date_month %>;
    CLD.SM.value=<%= now_date_month %>;
    drawCld(<%= now_date_year %>,<%= now_date_month %>)
    </script>
      

  5.   

    楼上的不要盗版
    第4段:
    <script>
    function lzbig_DAY(){
     lzlObj=eval('lzDAY');
     
     lzcld=new calendar(<%= today_year %>,<%= today_month-1 %>);
      //if(lzcld[<%= today_date-1 %>].lDay==1) 
                 //lzlObj.innerHTML='<b>'+(lzcld[<%= today_date-1 %>].isLeap?'闰':'') + lzcld[<%= today_date-1 %>].lMonth + '月' + (monthDays(lzcld[<%= today_date-1 %>].lYear,lzcld[<%= today_date-1 %>].lMonth)==29?'小':'大')+'</b>';
      //else 
                 lzlObj.innerHTML=(lzcld[<%= today_date-1 %>].isLeap?'闰':'') + lzcld[<%= today_date-1 %>].lMonth + '月' + (monthDays(lzcld[<%= today_date-1 %>].lYear,lzcld[<%= today_date-1 %>].lMonth)==29?'小':'大')+'<br><br>'+cDay(lzcld[<%= today_date-1 %>].lDay);
     
    lzs=lzcld[<%= today_date-1 %>].lunarFestival;
             if(lzs.length>0) { 
                if(lzs.length>6) lzs = lzs.substr(0, 4)+'…';
                lzs = lzs.fontcolor('red');
             }
             else { //国历节日
                lzs=lzcld[<%= today_date-1 %>].solarFestival;
                if(lzs.length>0) {
                   size = (lzs.charCodeAt(0)>0 && lzs.charCodeAt(0)<128)?8:4;
                   if(lzs.length>size+2) lzs = lzs.substr(0, size)+'…';
                   lzs = lzs.fontcolor('blue');
                }
                else { //廿四节气
                   lzs=lzcld[<%= today_date-1 %>].solarTerms;
                   if(lzs.length>0) lzs = lzs.fontcolor('limegreen');
                }
             }
              if(lzs.length>0) lzlObj.innerHTML = lzs;
    }
    </script><script>
    function changeCld() {
       var y,m;
       y=<%= now_date_year %>;
       m=<%= now_date_month %>;
       drawCld(y,m);
       document.CLD.submit();
    }
    </script>
    <SCRIPT language=javaScript>function clockon() {
    if (k==0){  FirstTime= new Date()
      ST='Friday, March 07, <%= now_date_year %> <%= now_date_hours %>:<%= now_date_minutes %>:<%= now_date_seconds %>';
      ServerTime=new Date(ST)
      H=ServerTime.getHours();
      M=ServerTime.getMinutes();
      S=ServerTime.getSeconds();
      D=ServerTime.getDate();
      Mo=ServerTime.getMonth()+1;
      Y=ServerTime.getYear();
      
      H1=FirstTime.getHours();
      M1=FirstTime.getMinutes();
      S1=FirstTime.getSeconds();
      D1=FirstTime.getDate();
      Mo1=FirstTime.getMonth()+1;
      Y1=FirstTime.getYear();  H2=H-H1
      M2=M-M1
      S2=S-S1
      D2=D-D1
      Mo2=Mo-Mo1
      Y2=Y-Y1
    }k=k+1thistime= new Date()
    H3=thistime.getHours();
    M3=thistime.getMinutes();
    S3=thistime.getSeconds();
    D3=thistime.getDate();
    Mo3=thistime.getMonth()+1;
    Y3=thistime.getYear();
    thistime=new Date(Y3+Y2,Mo3+Mo2,D3+D2,H3+H2,M3+M2,S3+S2)
    var hours=thistime.getHours()
    var minutes=thistime.getMinutes()
    var seconds=thistime.getSeconds()if (eval(hours) <10) {hours="0"+hours}
    if (eval(minutes) < 10) {minutes="0"+minutes}
    if (seconds < 10) {seconds="0"+seconds}
    thistime = hours+":"+minutes+":"+seconds
    if(document.all) {
    //bgclocknoshade.innerHTML=thistime
    bgclockshade.innerHTML=thistime
    }
    var timer=setTimeout("clockon()",1000)
    }</SCRIPT><br>
    <font color="666666"><strong>&nbsp; [日程安排]</strong></font> 
    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr> 
        <td width="25%" align="left" valign="top"> <table width="99%" height="240" border="0" align="left" cellpadding="0" cellspacing="0" class="sec-bk1">
            <tr> 
              <td> <div align="center"> 
                  <p><font color="#990000" size="6"><strong>今天</strong></font> <br>
                    <strong><font size="4">公元 <%= today_year %>年 <%= today_month %>月</font></strong><br>
                    <font color=#000000 face=宋体 id=lzGZ size=2></font> <font color=#000000 face=宋体 id=lzDAY  size=2></font><br>
                    <strong><font size="+4"><%= today_date %></font></strong> <br>
                    <strong><font color="F" size="4">星期</font><font size="4"><%= today_day_s %></font></strong></p>
                  <font color="#FF0000" size="3" id=bgclockshade></font> </div></td>
            </tr>
            <tr> 
              <td height="7"></td>
            </tr>
          </table></td>
        <td width="75%" align="center"> <table width="100%" border="0" cellpadding="0" cellspacing="0" >
            <tr> 
              <td align="right"> <table width="99%" height=27 border="1" cellpadding="0" cellspacing="0"  bordercolor="#dcdcdc" bordercolorlight="#dcdcdc" bordercolordark="#FFFFFF" class="caltab"  >
                  <tr> 
                    <form action="" method="post" name=CLD>
                      <td height=24 colspan=7 bgcolor="#ffcc00"> <div align="center"><font color="#000000">转到:年</font> 
                          <select name=SY 
                            onChange=changeCld() style="FONT-SIZE: 9pt">
                            <script language=JavaScript><!--  
                for(i=1900;i<2050;i++) {
    document.write('<option value="'+i+'">'+i)  ;
    document.write('</option>');
    }
                //--></script>
                          </select>
                          <font color="#000000">月</font> 
                          <select name=SM 
                            onChange=changeCld() style="FONT-SIZE: 9pt">
                            <script language=JavaScript><!--  
                for(i=1;i<13;i++) {
    document.write('<option value="'+i+'">'+i)  ;
    document.write('</option>');
    }
                //--></script>
                          </select>
                          <font 
                      color=#000000 face=宋体 id=GZ size=2>&nbsp;</font></div></td>
                    </form>
                  </tr>
                  <tr align=middle > 
                    <td height=1 colspan="7"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#fffcda">
                        <tr align="center" bgcolor="#efefef"> 
                          <td width="16%"> 日</td>
                          <td> 一</td>
                          <td> 二</td>
                          <td> 三</td>
                          <td> 四</td>
                          <td> 五</td>
                          <td> 六</td>
                        </tr>
                      </table></td>
                  </tr>
                  <tr align=middle> 
                    <td width=16% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                    <td width=14% height=1 bgcolor="#00FFFF"></td>
                  </tr>
                  <% 
      int gNum=0;
      for(int i=0; i<6;i++){
      out.print("<tr>");
         for(int j=0;j<7;j++){
     gNum=i*7+j;
     %>
                  <script>
     var lzsw=new Array(42);
    function lzsent(lzgNum){
    //alert(lzSD[lzgNum]);
    //main.opener.location='sec_arrange_add.jsp?today='+lzSD[lzgNum];
    var y,m;
       y=CLD.SY.options.selectedIndex+1900;
       m=CLD.SM.options.selectedIndex+1;document.location='sec_arrange_add.jsp?today='+lzSD[lzgNum]+'&year='+y+'&month='+m; 
    //document.CLD.submit();
    //return lzSD[lzgNum];
    //lzsw[lzgNum]=lzSD[lzgNum];
    }</script>
                  <td bgcolor="#FfFFF7" id="GD<%= gNum %>" onDblClick = "lzsent(<%= gNum %>)" title="双击鼠标添加当日日程" name= "GD<%= gNum %>"> 
                    <font id="SD<%= gNum %>"  size=2 face="Arial Black">&nbsp; </font> 
                    <br> <font id="LD<%= gNum %>" size=2 style="font-size:9pt">&nbsp; 
                    </font> <a id="SHOW<%= gNum %>" align=right> </a> </td>
                  <%
     }
     out.print("</tr>");
      }
       %>
                </table></td>
            </tr>
            <tr> 
              <td height="7"></td>
            </tr>
          </table></td>
      </tr>
    </table>
    <script>
    //////设置年月
    lzbig_DAY();
    CLD.SY.selectedIndex=<%= now_date_year %>;
    CLD.SY.value=<%= now_date_year %>;
    CLD.SM.selectedIndex=<%= now_date_month %>;
    CLD.SM.value=<%= now_date_month %>;
    drawCld(<%= now_date_year %>,<%= now_date_month %>)
    </script
      

  6.   

    linens(存储过程) :这个日程安排确实不错,不过我想要的是javabean封装,JSP调用。
      

  7.   

    封装的有什么好啊,封装在BEAN里HTML还要自己用PRINT打出来而且也不能用javascript,而且某些地方用javascript多方便!
      

  8.   

    哈,哈 我写有一bean不过只有阳历,有兴趣没??
      

  9.   

    linens,不是吧?我怎么测试了你的程序啥都没看到?你这三个帖子是一个程序还是几个程序,感觉很乱。
      

  10.   

    我有测试过了 linens  的程序,界面确实出来了,但感觉比较乱。这两天一直在修改中,
    由于能力有限,所以有很多地方都不明白。 AllError(错误大全) :只有阳历我也有兴趣。