var theCell=theRow.insertCell(j);
theCell.style.CSSText="background-color:#F0F0F0;cursor:default;";
}
}
}
//****************调整日历位置**************//
var offsetPos=calendar.getAbsolutePos(calendar.source);//计算对像的位置;
if((document.body.offsetHeight-(offsetPos.y+calendar.source.offsetHeight-document.body.scrollTop))<calendar.calendarPad.style.pixelHeight){
var calTop=offsetPos.y-calendar.calendarPad.style.pixelHeight;
}
else{
var calTop=offsetPos.y+calendar.source.offsetHeight;
}
if((document.body.offsetWidth-(offsetPos.x+calendar.source.offsetWidth-document.body.scrollLeft))>calendar.calendarPad.style.pixelWidth){
var calLeft=offsetPos.x;
}
else{
var calLeft=calendar.source.offsetLeft+calendar.source.offsetWidth;
}
//alert(offsetPos.x);
calendar.calendarPad.style.pixelLeft=calLeft;
calendar.calendarPad.style.pixelTop=calTop;
}
/****************** 计算对像的位置 *************************/
this.getAbsolutePos = function(el) {
var r = { x: el.offsetLeft, y: el.offsetTop };
if (el.offsetParent) {
var tmp = calendar.getAbsolutePos(el.offsetParent);
r.x += tmp.x;
r.y += tmp.y;
}
return r;
};
相关专题
- JavaScript教程 (577次浏览)
- 用javascript实现浮点数的截取小数位数,并 (514次浏览)
- 用javascript操作xml (335次浏览)
- javascript表单之间的数据传递 (327次浏览)
- JavaScript自定义模式对话框 (140次浏览)
- 用javascript的正则表达式来验证Email地址是 (135次浏览)
- 实用javaScript技术总结(1):屏蔽类 (119次浏览)
- asp结合javascript,xml,sqlserver制作的无 (110次浏览)
- 107条Javascript的常用语句 (101次浏览)
- Javascript实例教程(1) 目录 (74次浏览)



