日期:2014-05-16  浏览次数:20359 次

js日历脚本
         var language = 'en';
var enablePast = 0;
var fixedX = -1;
var fixedY = -1;
var startAt = 1;
var showWeekNumber = 0;
var showToday = 1;
var imgDir = 'images/';
var dayName = '日';

var gotoString = {
en : '当前月'
};
var todayString = {
en : '今天:'
};
var weekString = {
en : '星期'
};
var scrollLeftMessage = {
en : '上月'

};
var scrollRightMessage = {
en : '下月'

};
var selectMonthMessage = {
en : '选择月份.'
};
var selectYearMessage = {
en : '选择年份.'
};
var selectDateMessage = {
en : 'Go'
};
var monthName = {
en : new Array('1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月')

};
var monthName2 = {
en : new Array('1','2','3','4','5','6','7','8','9','10','11','12')

};

if (startAt==0) {
dayName = {
en : new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六')

};
} else {
dayName = {
en : new Array('一','二','三','四','五','六','日')

};
}

var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear, selDayAction, isPast;
var visYear  = 0;
var visMonth = 0;
var bPageLoaded = false;
var ie  = document.all;
var dom = document.getElementById;
var ns4 = document.layers;
var today    = new Date();
var dateNow  = today.getDate();
var monthNow = today.getMonth();
var yearNow  = today.getYear();
var timeNow  = today.getHours() + ":" + today.getMinutes() +":" + today.getSeconds();
var imgsrc   = new Array('pcaldrop1.gif','pcaldrop2.gif','pcalleft1.gif','pcalleft2.gif','pcalright1.gif','pcalright2.gif');
var img      = new Array();
var bShow    = false;

function hideElement( elmID, overDiv ) {
if(ie) {
for(i = 0; i < document.all.tags( elmID ).length; i++) {
obj = document.all.tags( elmID )[i];
if(!obj || !obj.offsetParent) continue;

// Find the element's offsetTop and offsetLeft relative to the BODY tag.
objLeft   = obj.offsetLeft;
objTop    = obj.offsetTop;
objParent = obj.offsetParent;

while(objParent.tagName.toUpperCase() != 'BODY') {
objLeft  += objParent.offsetLeft;
objTop   += objParent.offsetTop;
objParent = objParent.offsetParent;
}

objHeight = obj.offsetHeight;
objWidth  = obj.offsetWidth;

if((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft);
else if((overDiv.offsetTop + overDiv.offsetHeight) <= objTop);
/* CHANGE by Charlie Roche for nested TDs*/
else if(overDiv.offsetTop >= (objTop + objHeight + obj.height));
/* END CHANGE */
else if(overDiv.offsetLeft >= (objLeft + objWidth));
else {
obj.style.visibility = 'hidden';
}
}
}
}

function showElement(elmID) {
if(ie) {
for(i = 0; i < document.all.tags( elmID ).length; i++) {
obj = document.all.tags(elmID)[i];
if(!obj || !obj.offsetParent) continue;
obj.style.visibility = '';
}
}
}

function HolidayRec (d, m, y, desc) {
this.d = d;
this.m = m;
this.y = y;
this.desc = desc;
}

var HolidaysCounter = 0;
var Holidays = new Array();<