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

HTML/XHTML教程
HTML表格标记教程(4):边框色属性BORDERCOLOR
HTML表格标记教程(1):制作表格
HTML表格标记教程(2):表格的边框属性BORDER
HTML教程,简单学习HTML语言(2)
HTML表格标记详细讲解(适合初学者)
网页制作解惑:图象文件的路径
HTML教程,简单学习HTML语言
HTML基础:HTML的基本结构
HTML教程,认识optgroup元素
网页输入框的样式触发效果
HTML教程,HTML默认样式
超链接打开目标(target)的测试
XHTML教程,简单认识XHTML基础知识
HTML表格标记教程(35):跨列属性COLSPAN
HTML表格标记教程(33):单元格的垂直对齐属性VALIGN
HTML表格标记教程(34):跨行属性ROWSPAN
HTML表格标记教程(31):单元格的宽度和高度属性WIDTH、HEIGHT
HTML表格标记教程(32):单元格的水平对齐属性ALIGN
HTML表格标记教程(30):单元格的暗边框色属性BORDERCOLORDARK
HTML表格标记教程(28):单元格的边框色属性BORDERCOLOR

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


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