当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > 源码学习:一个简单的日历控件(8)

HTML/XHTML教程
CSS基础:设计网页常用规范详解
CSS教程:十步学会用css建站
CSS基础:24条网页布局开发小技巧
CSS教程:在网页布局中简单实现垂直居中的办法
css基础教程:颜色和文本属性的控制
专家总结:网页设计师必须遵守的十条守则
html技巧:超级链接a的提示和打开方式
css教程:学习背景图像属性background
例说网页Semantics:Html/Xhtml是否真正符合标准
IE7与web标准设计系列教程:前言
IE7与web标准设计系列教程:更丰富的CSS选择符
IE7与web标准设计系列教程:修正引起页面布局混乱的祸首
web标准教程:IE6和IE7的共存
web标准:IE多版本共存的解决方案:IETester
CSS基础教程:认识CSS选择符
web标准:比较IE6与IE7,放纵的孩子与严厉的父亲
学好标准CSS的模型是否必须放弃IE?
CSS教程:如何处理有冲突的CSS规则
教你用html和css写出漂亮正规的Blog
CSS基础:如何避免table强迫症

HTML/XHTML教程 中的 源码学习:一个简单的日历控件(8)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 51 ::
收藏到网摘: n/a

  //************* 插入日期单元格 **************/
  this.insertBodyCell=function(theRow,j,day,targetObject){
   var theCell=theRow.insertCell(j);
   if(j==0) var theBgColor="#FF9999";
   else var theBgColor="#FFFFFF";
   if(day==calendar.currentDate) var theBgColor="#CCCCCC";
   if(day==calendar.today) var theBgColor="#99FFCC";
   theCell.bgColor=theBgColor;
   theCell.innerText=day;
   theCell.align="center";
   theCell.width=35;
   theCell.style.cssText="border:1 solid #CCCCCC;cursor:hand;";
   theCell.onmouseover=function(){
    theCell.bgColor="#FFFFCC";
    theCell.style.cssText="border:1 outset;cursor:hand;";
   }
   theCell.onmouseout=function(){
    theCell.bgColor=theBgColor;
    theCell.style.cssText="border:1 solid #CCCCCC;cursor:hand;";
   }
   theCell.onmousedown=function(){
    theCell.bgColor="#FFFFCC";
    theCell.style.cssText="border:1 inset;cursor:hand;";
   }
   theCell.onclick=function(){
    if(calendar.currentDate.length<2) calendar.currentDate="0"+calendar.currentDate;
    if(day.toString().length<2) day="0"+day;
    calendar.sltDate=calendar.currentDate[0]+"-"+calendar.currentDate+"-"+day;
    calendar.target.value=calendar.sltDate;
    calendar.hide();
   }
  }
  /************** 取得月份的第一天为星期几 *********************/
  this.getFirstDay=function(theYear, theMonth){
   var firstDate = new Date(theYear,theMonth-1,1);
   return firstDate.getDay();
  }
  /************** 取得月份共有几天 *********************/