打印本文 打印本文 关闭窗口 关闭窗口
一个很好的日历控件(采用javascript编写)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数2702  更新时间:2009/4/23 11:28:03  文章录入:mintao  责任编辑:mintao
    var weekMilliseconds = 1000*60*60*24*7;

    if(dCurrentMonthFirstSunday > 0) iDays = -dCurrentMonthFirstSunday;

   

    var fTrgt = targetURL;

    while (fTrgt.indexOf("'") >= 0) fTrgt = fTrgt.replace("'", "`");

    while (fTrgt.indexOf("`") >= 0) fTrgt = fTrgt.replace("`", "\\'");

   

    var oBuf = '<TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">';      

    oBuf += '<TR><TD CLASS="calendarhd"><A HREF="javascript:showCalendar(\'' + targetID + "','" + fTrgt + "'," + (dMonth - 1) + ',' + dYear + ',90);"><img src="Images/leftArrow.gif" border=0 /></A></TD>';

    oBuf += '<TD COLSPAN="5" CLASS="calendarhd">' + (calendar_MonthNames[dMonth]) + ' ' + dYear + '</TD>';

    oBuf += '<TD CLASS="calendarhd"><A HREF="javascript:showCalendar(\'' + targetID + "','" + fTrgt + "'," + (dMonth + 1) + ',' + dYear + ',90);"><img src="Images/rightArrow.gif"  border=0 /></A></TD></TR>';

    oBuf += '<TR style="calendarhdrow">';

   

    for(var e=0; e < 7; e++) oBuf += '<TD CLASS="calendarDays">' + calendar_DayNames[e] + '</TD>';         

    oBuf += '</TR>';

 

    var nextMonthFirstDay = new Date(dYear, dMonth+1, 1);

    var IsNextMonthFirstDaySunday = nextMonthFirstDay.getDay()==0;

       

    for(var iRows=0; iRows < 6; iRows++)

    {

        dCurrentMonthDate = new Date(dCurFD.getFullYear(), dCurFD.getMonth(), dCurFD.getDate() + iDays);

        if(1==1)        

        {

        if(iRows==5 && dCurrentMonthDate.getMonth() > dCurFD.getMonth()) continue;       

        if(iRows==5 && IsNextMonthFirstDaySunday) continue;

               

        oBuf += '<TR CLASS="calendarContent">';

        for(var iCols=0; iCols < 7; iCols++)

        {

            dCurrentViewDate = new Date(dCurFD.getFullYear(), dCurFD.getMonth(), dCurFD.getDate() + iDays);

 

            if((dGivenDate.toDateString() == dCurrentViewDate.toDateString()) && (dDay != 90))

            {

                oBuf += '<TD CLASS="selectedDate">';

            }

            else

            {

                if(dCurrentViewDate.getMonth() != dMonth || iDays < 0)

                {

                    oBuf += '<TD CLASS="negDate">';

                }

                else

                {

                    oBuf += '<TD CLASS="posDate">';

                }

            }           

上一页  [1] [2] [3]  下一页

打印本文 打印本文 关闭窗口 关闭窗口