/*********************************************** Fool-Proof Date Input Script with DHTML Calendar by Jason Moon - webmaster@moonfam.net modified by 木鸟 - www.wqcms.net ************************************************/ // Customizable variables var DefaultDateFormat = 'MM/DD/YYYY'; // If no date format is supplied, this will be used instead var HideWait = 3; // Number of seconds before the calendar will disappear var Y2kPivotPoint = 76; // 2-digit years before this point will be created in the 21st century var FontSize = 11; // In pixels var FontFamily = 'Tahoma'; var CellWidth = 18; var CellHeight = 16; var ImageURL = 'pic/calendar.jpg'; var NextURL = 'pic/calendar_next.gif'; var PrevURL = 'pic/calendar_prev.gif'; var NextYearURL = 'pic/calendar_nextYear.gif'; var PrevYearURL = 'pic/calendar_prevYear.gif'; var CalBGColor = 'white'; var TopRowBGColor = 'buttonface'; var DayBGColor = 'lightgrey'; // Global variables var ZCounter = 100; var Today = new Date(); //var WeekDays = new Array('S','M','T','W','T','F','S'); var WeekDays = new Array('日','一','二','三','四','五','六'); var MonthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); //var MonthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December'); var MonthNames = new Array('1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'); if(document.charset=="big5"){ var WeekDays = new Array('ら','','','','','き','せ'); var MonthNames = new Array('1る','2る','3る','4る','5る','6る','7る','8る','9る','10る','11る','12る'); } // Write out the stylesheet definition for the calendar with (document) { writeln(''); } // Only allows certain keys to be used in the date field function NumOnly(e) { var KeyCode = (e.keyCode) ? e.keyCode : e.which; return ((KeyCode == 8) // backspace || (KeyCode == 9) // tab || (KeyCode == 37) // left arrow || (KeyCode == 39) // right arrow || (KeyCode == 46) // delete || ((KeyCode > 47) && (KeyCode < 58)) // 0 - 9 ); } // Gets the absolute pixel position of the supplied element function GetTagPixels(StartTag, Direction) { var PixelAmt = (Direction == 'LEFT') ? StartTag.offsetLeft : StartTag.offsetTop; while ((StartTag.tagName != 'BODY') && (StartTag.tagName != 'HTML')) { StartTag = StartTag.offsetParent; PixelAmt += (Direction == 'LEFT') ? StartTag.offsetLeft : StartTag.offsetTop; } return PixelAmt; } // Is the specified select-list behind the calendar? function BehindCal(SelectList, CalLeftX, CalRightX, CalTopY, CalBottomY, ListTopY) { var ListLeftX = GetTagPixels(SelectList, 'LEFT'); var ListRightX = ListLeftX + SelectList.offsetWidth; var ListBottomY = ListTopY + SelectList.offsetHeight; return (((ListTopY < CalBottomY) && (ListBottomY > CalTopY)) && ((ListLeftX < CalRightX) && (ListRightX > CalLeftX))); } // For IE, hides any select-lists that are behind the calendar function FixSelectLists(Over) { if (navigator.appName == 'Microsoft Internet Explorer') { var CalDiv = this.getCalendar(); var CalLeftX = CalDiv.offsetLeft; var CalRightX = CalLeftX + CalDiv.offsetWidth; var CalTopY = CalDiv.offsetTop; var CalBottomY = CalTopY + (CellHeight * 9); var FoundCalInput = false; formLoop : for (var j=this.formNumber;j