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

HTML/XHTML教程
认清CSS的类class和标识id选择符
网站设计之合理架构css
用css样式表实现首字大写特效
DIV与Table布局在大型网站的可用性比较
css滑动门技术的一些总结和归纳
CSS的“顶级”技巧
谈谈CSS样式表中的类和伪类
网站重构 CSS样式表的优化与技巧
网页设计中针对中文排版CSS心得
如何有效管理好CSS
怎样管理好样式
完全CSS写的鼠标悬停tip效果
CSS中display与visibility的区别
实时切换网页的CSS样式实现
Div + CSS 高度自适应解决方案
XHTML+CSS布局之XHTML应用小结
css布局定位系列:相对定位
使用图片和CSS结合制作动画按钮
Div+CSS网站设计的优点
5款纯div+css制作的弹出菜单(标准且无js)

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 54 ::
收藏到网摘: 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();
  }
  /************** 取得月份共有几天 *********************/