文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>显示日历的网页程序

显示日历的网页程序

时间:2007-11-27  来源:kicoo


  
  
日历  
  
.normal{BACKGROUND: #ffffff}  
.today {font-weight:bold;BACKGROUND: #6699cc}  
.satday{color:green}  
.sunday{color:red}  
.days {font-weight:bold}  
  
=4));
  // 如果是Netscape4.0或更高版本,ns为true,否则为false
  this.ns=((navigator.appName=='Netscape')&&(parseInt(this.ver)>=4));
  // 是否为ie、Netscape中的一种
  this.bw=(this.ie||this.ns);
  // 返回此对象
  return this;
}
var bw = new checkBrowser();
//中文月份,如果想显示英文月份,修改下面的注释  
/*var months = new Array("January?, "February?, "March",  
"April", "May", "June", "July", "August", "September",  
"October", "November", "December");*/  
var months = new Array("1月", "2月", "3月",  "4月", "5月", "6月", "7月", "8月", "9月",  "10月", "11月", "12月");  
var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);  
//中文周 如果想显示 英文的,修改下面的注释  
/*var days = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");*/  
var days = new Array("日","一", "二", "三", "四", "五", "六");  
// 下面的这段代码是返回本月的最大日期
function getDays(month, year) {               
if (1 == month)                        // 闰年要判断
return ((0 == year % 4) && (0 != (year % 100))) || (0 == year % 400) ? 29 : 28;  
else  
return daysInMonth[month];        // 其它各月的天数已经在 数组daysInMonth中定义
}  
//今天的年,月,日
function getToday() {           
this.now = new Date();  
this.year = this.now.getFullYear();  
this.month = this.now.getMonth();  
this.day = this.now.getDate();  
}  
var today = new getToday();  
function newCalendar() {        // 显示日历表中的数字
today = new getToday();  
// var parseYear = parseInt(document.all.year[document.all.year.selectedIndex].text);   // delete by cc.cai 2003/10/01
var objyear = document.getElementById("year");                                                                                        //  2 rows added by cc.cai 2003/11/01
var parseYear = parseInt(objyear[objyear.selectedIndex].text);
// var newCal = new Date(parseYear,document.all.month.selectedIndex, 1);                                // delete by cc.cai 2003/11/01
var objmonth = document.getElementById("month");                                                                                //  2 rows added by cc.cai 2003/11/01
var newCal = new Date(parseYear,objmonth.selectedIndex, 1);
// alert("newCal:"+newCal);
var day = -1;  
var startDay = newCal.getDay();  
//alert("startDay:"+startDay);
var daily = 0;  
if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))  
   day = today.day;  
   // var tableCal = document.all.calendar.tBodies.dayList;
   var tableCal = document.getElementById("dayList");   
   var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear());  
   // alert("本月的天数=" + intDaysInMonth);
   for (var intWeek = 0; intWeek  0) && (daily
function getDate(evnt) {                        // ie 支持 event.srcElement.innerHTML 而 ns 支持 evnt.target.innerHTML
var sDate,sYear,sMonth,sDay;
// alert("这段代码处理鼠标点击的情况 " + "bw.ie=" + bw.ie + "  bw.ns=" + bw.ns);
        if (bw.ie)                // ie
            if ("TD" != event.srcElement.tagName)
              { return false;}
            else
              if ("" != event.srcElement.innerText)
            {
               // document.all.year.value + "年" + document.all.month.value + "月" + event.srcElement.innerText + "日";
               // sYear = document.all.year.value;   // delete by cc.cai 2003/10/01
               var objyear = document.getElementById("year");                                                                                        //  2 rows added by cc.cai 2003/11/01
               sYear = objyear.value;
               var objmonth = document.getElementById("month");                                                                                        //  2 rows added by cc.cai 2003/11/01
               sMonth = (objmonth.value.length==2)?objmonth.value:"0"+objmonth.value;
               sDay = (event.srcElement.innerText.length==2)?event.srcElement.innerText:"0"+event.srcElement.innerText;
               sDate = sYear+"/"+sMonth+"/"+sDay;
             }
    if (bw.ns)                        // ns
    {  if ("TD" != evnt.target.tagName)
        { return false;}
            else
              if ("" != evnt.target.innerHTML)
            {
               // document.all.year.value + "年" + document.all.month.value + "月" + event.srcElement.innerText + "日";
               // sYear = document.all.year.value;   // delete by cc.cai 2003/10/01
               var objyear = document.getElementById("year");                                                                                        //  2 rows added by cc.cai 2003/11/01
               sYear = objyear.value;
               var objmonth = document.getElementById("month");                                                                                        //  2 rows added by cc.cai 2003/11/01
               sMonth = (objmonth.value.length==2)?objmonth.value:"0"+objmonth.value;
               sDay = (evnt.target.innerHTML.length==2)?evnt.target.innerHTML:"0"+evnt.target.innerHTML;
               sDate = sYear+"/"+sMonth+"/"+sDay;
         }
        }
   alert(sDate);
        
}
function monthchanged(todo) {
    // alert("aa:"+ month.selectedIndex);
        var newindex = month.selectedIndex;
        if (todo == "prev")
                newindex= (month.selectedIndex - 1) = month.length ?0:month.selectedIndex + 1;
        //alert("newindex:"+newindex);
        //alert("newValue:"+month[newindex].value);
        month[newindex].selected = true;
}
//-->
  
  
  
  
  
  
  
  
  
  
        for (var intLoop = 0; intLoop " + months[intLoop]);  
  
  
  
  
        for (var intLoop = today.year-5; intLoop " + intLoop);  
  
  
  
  
  

        document.write("" + days[0] + "");  
        for (var intLoop = 1; intLoop " + days[intLoop] + "");  
        document.write("" + days[intLoop] + "");  
  
  
  
  
  
        for (var intWeeks = 0; intWeeks ");  
                for (var intDays = 0; intDays ");  
                document.write("");  
        }  
  
  
  
  
  
  
function Cancel() {  
// document.all.ret.value = "";  
document.getElementById("ret").value = "" ;                        // modify by cc.cai 2003/11/01
window.close();  
}  


相关阅读 更多 +
排行榜 更多 +
后室双重现实游戏下载

后室双重现实游戏下载

冒险解谜 下载
魔音少女模拟器下载最新版

魔音少女模拟器下载最新版

模拟经营 下载
雷曼大冒险官方版下载

雷曼大冒险官方版下载

冒险解谜 下载