我们要做一个 日工作总结-- 日报周报填写。的东西,  要画一个日历 点击相应的天,弹出填写窗体,保存。类似于这个:http://bjtime.cn/ 里边的日历控件,但不需要阴历和节日的。谢谢大家了,我对这方面不懂啊! 请大家帮帮忙!~

解决方案 »

  1.   

    日历文件:Default2.aspx
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
        <style>
    body,td { font-size:9pt; }
    input
    {
    color:333333;
    font-size:9pt;
    border-width:0;
    padding:2;
    width:20;
    }
    </style>    <script language=javascript>
    <!--
        var monthNames = new Array ( "", "1","2","3","4","5","6","7", "8", "9", "10", "11", "12" );
        var endDay = new Array ( 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
        var dayNow = 0;
        var monthNow = 0;
        var yearNow = 0;
        function Cstartup ( form ) {
           set_month_year_now ();
            var found = false;
            for ( var month=0; month<form.monthList.length; month++ )
                if ( form.monthList[month].text == monthNames[monthNow] ) {
                    form.monthList[month].selected = true;
                    found = true;
                }        if ( !found) {
                out_of_range_error ();
                return;
            }
            var found = false;
            for ( var year=0; year<form.yearList.length; year++ )
                 if ( form.yearList[year].text == yearNow ) {
                    form.yearList[year].selected = true;
                    found = true;
                 }
            if ( !found) {
                out_of_range_error ();
                return;
            }
            display_month ( form );
        }
        function preceding_month ( form ) {
            var month_selected = form.monthList.selectedIndex;
            var year_selected = form.yearList.selectedIndex;        if ( !month_selected && !year_selected )  {
                out_of_range_error ();
                return;
            }        if ( month_selected > 0 )
                month_selected --;
            else {
                month_selected = 11;
                year_selected --;
            }
            form.monthList[month_selected].selected = true;
            form.yearList[year_selected].selected = true;
            display_month ( form );
        }
        function following_month ( form ) {
            var month_selected = form.monthList.selectedIndex;
            var year_selected = form.yearList.selectedIndex;
            if ( month_selected >= ( form.monthList.length - 1 ) && year_selected >= ( form.yearList.length - 1 ) ) {
                out_of_range_error ();
                return;
            }        if ( month_selected < 11 )
                month_selected ++;
            else {
                month_selected = 0;
                year_selected ++;
            }        form.monthList[month_selected].selected = true;
            form.yearList[year_selected].selected = true;
            display_month ( form );
        }
        function set_month_year_now ()   {
            var form = document.form1;
            var now = new Date ();
            monthNow = now.getMonth () + 1;
            yearNow = now.getYear ();
            dayNow = now.getDate();
            yearNow = ( yearNow < 100 ) ? yearNow + 1900 : yearNow;        var count = 0        for (var i = yearNow-103; i < yearNow + 50; i++) {
              eval("form.yearList.options[count] = new Option('"+i+"', '"+i+"')");
              count++;
            }
            form.yearList.selectedIndex = 103;
            form.yearList.length = count;
        }    function out_of_range_error ()   {
            alert ( "超出范围!" );
        }
        function display_month ( form )  {
            var month = form.monthList.selectedIndex + 1;
            var year = parseInt ( form.yearList.options[ form.yearList.selectedIndex].text );
            var start_day = start_day_in_month ( year, month );
            var count = 0;
            for ( var row=0; row<6; row++) {
                for ( var col=0; col<7; col++ )
                {
                    if ( row == 0 && col < ( start_day - 1 ) )
                        var day = "";
                    else if ( count < endDay[month] )
                        day = ++count;
                    else
                        day = "";
                    form.dayBox[(row*7)+col].style.display = "";
                    form.dayBox[(row*7)+col].style.color = "#000000";                if (day == "") {
                      form.dayBox[(row*7)+col].style.display = "none";
                    } else {
                    form.dayBox[(row*7)+col].value = day;
                    if (col%7 == 0) form.dayBox[(row*7)+col].style.color = "#FF0000";
                    if (yearNow == year && monthNow == month && dayNow == day) form.dayBox[(row*7)+col].style.color = "#0000FF";;
                  }
                }
            }
        }
       
      

  2.   

    继续上页:
      function start_day_in_month ( year, month )   {
            var  day, daynum, ndays, mnum;
            sday = start_day_in_year ( year );
            endDay[2] = ( year % 4 ) ? 28 : 29;
            if ( month == 1 )
                daynum = sday;
            else {
                ndays = sday;
                for ( mnum=2; mnum<month+1; mnum++ )
                    ndays = ndays + endDay[mnum-1];
                daynum = ndays % 7;
            }
            daynum = (!daynum) ? 7 : daynum;
            return (daynum);
        }
        function start_day_in_year ( year )   {
            var y, m, d;
            var n;        y = year - 1; m = 13; d = 1;
            n = d + 2 * m + ( Math.floor ( ( 0.6 + (m + 1) ) ) + y );
            n = n + Math.floor ( ((y / 4) - Math.floor ( (y / 100 ) ) + Math.floor ( ( y / 400 ) ) )                                                                               ) + 2 ;
            n = Math.floor ( ( (n / 7 - Math.floor ( (n / 7) ) ) * 7 + 0.5 ) );
            return (n+1);
        }
      function CheckDate(strDay) {
       var docFrm = document.form1;
       var choice_daynum = 0;
       var current_daynum = 0;
       var day_temp;
       if (strDay != "") {
         var strY = docFrm.yearList.value;
         var strM = docFrm.monthList.value;
         var curr_y = new String(yearNow);
         var curr_m = new String(monthNow);
         var curr_d = new String(dayNow);
         if (curr_m.length == 1) curr_m = "0"+curr_m;
         if (curr_d.length == 1) curr_d = "0"+curr_d;
         current_daynum = new Number(curr_y + curr_m + curr_d) ;     if (strM.length == 1) strM = "0"+strM;
         if (strDay.length == 1) strDay = "0"+strDay;       choice_daynum = new Number(strY + strM + strDay);
           parent.window.returnValue = strY+"-"+strM+"-"+strDay;  //将选择的日期传递到父窗口中
           parent.window.close();
       }
       return false;
      }
    -->
    </script></head>
    <body onLoad="Cstartup(document.form1)" topmargin="0">
        <form id="form1" runat="server">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td colspan="3" height="24"></td>
          </tr>
          <tr>
            <td width="205" nowrap="nowrap" align="right"><select name="yearList" onChange="display_month(this.form)">
              </select>
            </td>
            <td width="65" nowrap="nowrap" align="left"><select name="monthList" size="1" onChange="display_month(this.form)">
                <%for(int i=1;i<13;i++){%>
                <option value="<%=i%>"><%=i%></option>
                <%}%>
              </select>
            </td>
            <td width="10"></td>
          </tr>
          <tr>
            <td colspan="3" height="6"></td>
          </tr>
          <tr>
            <td colspan="3"><table border="0" cellpadding="1" cellspacing="0" align="center">
                <tr>
                  <td bgcolor="#82664F"><table border="0" cellpadding="0" cellspacing="0">
                      <tr bgcolor="#82664F" height="18">
                        <td width="31" align="center" nowrap="nowrap"><font color="#FF0000">日</font></td>
                        <td width="31" align="center" nowrap="nowrap">一</td>
                        <td width="31" align="center" nowrap="nowrap">二</td>
                        <td width="31" align="center" nowrap="nowrap">三</td>
                        <td width="31" align="center" nowrap="nowrap">四</td>
                        <td width="31" align="center" nowrap="nowrap">五</td>
                        <td width="31" align="center" nowrap="nowrap">六</td>
                      </tr>
                      <%for(int r=0;r<6;r++){%>
                      <tr bgcolor="#FFFFFF" height="18">
                        <%for(int d=0;d<7;d++){%>
                        <td align="center"><input type="text" size="2" name="dayBox" readOnly onClick="javascript:CheckDate(this.value);" onMouseOver="this.style.background='#EEEEEE'"  onmouseout="this.style.background='white'">
                        </td>
                        <%}%>
                      </tr>
                      <%}%>
                    </table></td>
                </tr>
              </table></td>
          </tr>
        </table>    </form>
    </body>
    </html>
      

  3.   

    调用页面如下:<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="BURNinput.aspx.cs" Inherits="BURNinput" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>BURN-IN REPORT</title>
        <style>body{margin-top:0px}</style>
    <script language="javascript">
    function Fcalendar(field){
       var rtn = window.showModalDialog("Default2.aspx","","dialogWidth:290px;dialogHeight:250px;status:no;help:no;scrolling=no;scrollbars=no");
       if(rtn!=null)
    field.value=rtn;
      return;
       }
    </script>
    </head>
    <body bgcolor="#ffffcc">
        <form id="form1" runat="server">
        <div style="text-align: center">
            <br />
            &nbsp;<asp:Label ID="Label10" runat="server" Font-Size="XX-Large" Height="46px" Text="BURN-IN   REPORT"
                Width="445px"></asp:Label><br />
            <br />
            <table style="width: 669px; height: 265px;" id="TABLE1" onclick="return TABLE1_onclick()">
                <tr>
                    <td style="width: 284px; height: 29px">
                        <a href="Default.aspx"><span style="font-size: 8pt"></span></a><span
                            style="font-size: 8pt">
                        </span>
            </td>
                    <td style="width: 66px; height: 29px;">
            <asp:Label ID="Label9" runat="server" Text="  日期" Width="86px" ></asp:Label></td>
                    <td style="width: 174px; height: 29px; text-align: left;">
            <asp:TextBox ID="Textdate" runat="server" Width="120px" onClick="Fcalendar(this)"></asp:TextBox>&nbsp;
                    </td>
                    <td style="width: 99px; height: 29px">
            <asp:Label ID="Label1" runat="server" Text="  型号" Width="88px"></asp:Label></td>
                    <td style="width: 83px; height: 29px;">
                        <asp:TextBox ID="Textxh" runat="server" Width="121px"></asp:TextBox></td>
                    <td style="width: 225px; height: 29px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 284px; height: 29px;">
                    </td>
                    <td style="width: 66px; height: 29px;">
            <asp:Label ID="Label3" runat="server" Text="生产日期" Width="87px"></asp:Label></td>
                    <td style="width: 174px; height: 29px; text-align: left;">
            <asp:TextBox ID="Textscrq" runat="server" Width="120px"></asp:TextBox></td>
                    <td style="width: 99px; height: 29px;">
            <asp:Label ID="Label2" runat="server" Text="  数量" Width="84px"></asp:Label></td>
                    <td style="width: 83px; height: 29px;">
            <asp:TextBox ID="Textqty" runat="server" Width="120px"></asp:TextBox></td>
                    <td style="width: 225px; height: 29px;">
                    </td>
                </tr>
                <tr>
                    <td style="width: 284px; height: 29px">
                    </td>
                    <td style="width: 66px; height: 29px">
            <asp:Label ID="Label4" runat="server" Text="小时/周期" Width="86px"></asp:Label></td>
                    <td style="width: 174px; height: 29px; text-align: left;">
                        <asp:DropDownList ID="DropDownList2" runat="server" Width="127px">
                            <asp:ListItem></asp:ListItem>
                            <asp:ListItem>500 cycles</asp:ListItem>
                            <asp:ListItem>6 HOURS</asp:ListItem>
                        </asp:DropDownList></td>
                    <td style="height: 29px; width: 99px;">
            <asp:Label ID="Label5" runat="server" Text=" 不良数" Width="85px"></asp:Label></td>
                    <td style="width: 83px; height: 29px">
            <asp:TextBox ID="Textfqty" runat="server" Width="120px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td style="width: 284px">
                    </td>
                    <td style="width: 66px; height: 26px">
            <asp:Label ID="Label6" runat="server" Text="不良描述" Width="86px"></asp:Label></td>
                    <td colspan="3" style="height: 26px; text-align: left">
            <asp:TextBox ID="Textblms" runat="server" Width="231px"></asp:TextBox></td>
                    <td colspan="1" style="width: 225px; height: 26px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 284px; height: 28px;">
                    </td>
                    <td style="width: 66px; height: 28px">
            <asp:Label ID="Label7" runat="server" Text="不良原因" Width="83px"></asp:Label></td>
                    <td colspan="3" style="height: 28px; text-align: left;">
            <asp:TextBox ID="Textreason" runat="server" Width="233px"></asp:TextBox></td>
                    <td colspan="1" style="width: 225px; height: 28px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 284px">
                    </td>
                    <td style="width: 66px">
            <asp:Label ID="Label8" runat="server" Text="不良分析" Width="85px"></asp:Label></td>
                    <td colspan="3" style="text-align: left">
                        <asp:DropDownList ID="DropDownList1" runat="server" Width="235px">
                            <asp:ListItem></asp:ListItem>
                            <asp:ListItem>Component defect</asp:ListItem>
                            <asp:ListItem>Workmenship defect</asp:ListItem>
                        </asp:DropDownList></td>
                    <td colspan="1" style="width: 225px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 284px">
                    </td>
                    <td style="width: 66px">
                        </td>
                    <td colspan="3" style="text-align: left">
                        </td>
                    <td colspan="1" style="width: 225px">
                    </td>
                </tr>
                <tr>
                    <td style="width: 284px; height: 28px;">
                    </td>
                    <td style="width: 66px; height: 28px;">
                    </td>
                    <td colspan="1" style="width: 174px; height: 28px;">
            <asp:Button ID="Button1" runat="server" Text="增 加" OnClick="Button1_Click" /></td>
                    <td colspan="1" style="width: 99px; height: 28px;">
                        <a href="Default.aspx"></a></td>
                    <td colspan="1" style="width: 83px; height: 28px;">
            </td>
                    <td colspan="1" style="width: 225px; height: 28px;">
                    </td>
                </tr>
            </table>
            <br />
            &nbsp; &nbsp;&nbsp;
            </div>
        </form>
    </body>
    </html>
      

  4.   

    调用页面定义function   Fcalendar(field);然后输入时间的文本框定义:<asp:TextBox   ID="Textdate"   runat="server"   Width="120px"   onClick="Fcalendar(this)"> </asp:TextBox> 
      

  5.   

    http://download.csdn.net/user/liuyun1987
    我放了一个时间的控件到网上去.你去下载下来看看.很实用的时间控件
      

  6.   

    大家给的好像是日历控件,VS2005 的Calendar控件 我也试过了,但是不行啊。Calendar里当点击某天时弹出一个对话框   填写内容,填写完点确定后,内容保存,对应这天的Calendar中的这个格的背景色(BackColor)改 变,要是没有添加内容   此格不变色,有几个有内容的   几个格变色。 那样也行,可是需要有按 月显示,按年显示,和按星期显示 数据的啊 还有单个背景色改变以后再点击别的时候就 又恢复到没有改的时候了。