IE11中的JavaScript日期选择器问题-crossobj.visibility=";“隐藏的”;;

IE11中的JavaScript日期选择器问题-crossobj.visibility=";“隐藏的”;;,javascript,datepicker,internet-explorer-11,Javascript,Datepicker,Internet Explorer 11,我们的应用程序是基于经销商的应用程序。这基本上是针对IE8浏览器实现的,现在由于经销商正在升级到IE11,我们在应用程序中面临很多问题(主要是UI)。其中一个问题是日期选择器 当用户在IE11浏览器(兼容模式)中单击日期选择器时,日期选择器弹出窗口将显示,而当用户在IE11浏览器(不兼容模式)中单击日期选择器时,不会执行任何操作。当我试图在IE浏览器中使用开发人员工具对此进行调试时,我在控制台“SCRIPT5007:无法设置未定义或空引用的属性“visibility”中发现了此错误,它指向函数h

我们的应用程序是基于经销商的应用程序。这基本上是针对IE8浏览器实现的,现在由于经销商正在升级到IE11,我们在应用程序中面临很多问题(主要是UI)。其中一个问题是日期选择器

当用户在IE11浏览器(兼容模式)中单击日期选择器时,日期选择器弹出窗口将显示,而当用户在IE11浏览器(不兼容模式)中单击日期选择器时,不会执行任何操作。当我试图在IE浏览器中使用开发人员工具对此进行调试时,我在控制台“SCRIPT5007:无法设置未定义或空引用的属性“visibility”中发现了此错误,它指向函数hideCalendar()中的代码段“crossobj.visibility=”hidden“。我试着在谷歌上搜索任何类似的问题,但我没有找到,所以我在这里发帖。请检查错误并帮助我解决此问题

请在下面找到日期选择器的完整代码:

<script>
var pathURL = '<%=request.getContextPath()%>';

    var fixedX = -1;                // x position (-1 if to appear below control)
    var fixedY = -1;                // y position (-1 if to appear below control)
    var startAt = 1;                    // 0 - sunday ; 1 - monday
    var showWeekNumber = 0;         // 0 - don't show; 1 - show
    var showToday = 0;              // 0 - don't show; 1 - show
    var imgDir = "/DIMSWEB/images/";    // directory for images ... e.g. var imgDir="/img/"

    var titlebar="#969798";
    var highlight="#FFCC99";

    var gotoString = "Go To Current Month";
    var todayString = "Today is";
    var weekString = "Wk";
    var scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically.";
    var scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically.";
    var selectMonthMessage = "Click to select a month.";
    var selectYearMessage = "Click to select a year.";
    var selectDateMessage = "Select [date] as date."; // do not replace [date], it will be replaced by date.

    var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear;

    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.getFullYear();
    var imgsrc = new Array("drop1.gif","drop2.gif","left1.gif","left2.gif","right1.gif","right2.gif");
    var img = new Array();
    var bShow = false;
    var calVal;
 /* hides <select> and <applet> objects (for IE only) */
 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 );
       else if( overDiv.offsetTop >= ( objTop + objHeight ));
       else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
       else
       {
         obj.style.visibility = "hidden";
       }
     }
   }
 }

 /*
 * unhides <select> and <applet> objects (for IE only)
 */
 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 = "";
     }
   }
 }


    if (dom)
    {
        for (i=0;i<imgsrc.length;i++)
        {
            img[i] = new Image
            img[i].src = imgDir + imgsrc[i]

                                         ///alert(img[i].src);
        }
        //Modified By Subhadip:On 07thAugust,2006
        document.write ("<div onclick='bShow=true' id='calendar' style='z-index:+999;position:absolute;visibility:hidden;width:100px'><table bgcolor='#969798' style='font-family:arial;font-size:10px;border-width:1;border-style:solid;border-color:#a0a0a0;font-family:arial; font-size:10px}' bgcolor='#ffffff'><tr bgcolor='" + titlebar + "'><td><table><tr><td style='padding:2px;font-family:arial; font-size:11px;'><font color='#ffffff'><B><span id='caption'></span></B></font></td><td align=right><a href='javascript:hideCalendar()'><img src='"+imgDir+"close.gif' width='15' height='13' border='0' alt='Close the Calendar'></a></td></tr></table></td></tr><tr><td style='padding:5px' bgcolor=#ffffff><span id='content1'></span></td></tr>")

        //Modified By Subhadip:On 07thAugust,2006   
        document.write ("</table></div><div id='selectMonth' style='z-index:+999;position:absolute;visibility:hidden;width:65px'></div><div id='selectYear' style='z-index:+999;position:absolute;visibility:hidden;width:45px'></div>");
    }

    //var   monthName = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
    var jan_key="<DimsBean:message key='january' langCode='${language}'></DimsBean:message>";
    var feb_key="<DimsBean:message key='february' langCode='${language}'></DimsBean:message>";
    var mar_key="<DimsBean:message key='march' langCode='${language}'></DimsBean:message>";
    var april_key="<DimsBean:message key='april' langCode='${language}'></DimsBean:message>";
    var may_key="<DimsBean:message key='may' langCode='${language}'></DimsBean:message>";
    var june_key="<DimsBean:message key='june' langCode='${language}'></DimsBean:message>";
    var july_key="<DimsBean:message key='july' langCode='${language}'></DimsBean:message>";
    var aug_key="<DimsBean:message key='august' langCode='${language}'></DimsBean:message>";
    var sep_key="<DimsBean:message key='september' langCode='${language}'></DimsBean:message>";
    var oct_key="<DimsBean:message key='october' langCode='${language}'></DimsBean:message>";
    var nov_key="<DimsBean:message key='november' langCode='${language}'></DimsBean:message>";
    var dec_key="<DimsBean:message key='december' langCode='${language}'></DimsBean:message>";


    var sun_key="<DimsBean:message key='sunday' langCode='${language}'></DimsBean:message>";
    var mon_key="<DimsBean:message key='monday' langCode='${language}'></DimsBean:message>";
    var tue_key="<DimsBean:message key='tuesday' langCode='${language}'></DimsBean:message>";
    var wed_key="<DimsBean:message key='wednesday' langCode='${language}'></DimsBean:message>";
    var thur_key="<DimsBean:message key='thursday' langCode='${language}'></DimsBean:message>";
    var fri_key="<DimsBean:message key='friday' langCode='${language}'></DimsBean:message>";
    var sat_key="<DimsBean:message key='saturday' langCode='${language}'></DimsBean:message>";


    var monthName = new Array(jan_key,feb_key,mar_key,april_key,may_key,june_key,july_key,aug_key,sep_key,oct_key,nov_key,dec_key);
    if (startAt==0)
    {
        dayName = new Array (sun_key,mon_key,tue_key,wed_key,thur_key,fri_key,sat_key)
    }
    else
    {
        dayName = new Array (mon_key,tue_key,wed_key,thur_key,fri_key,sat_key,sun_key)
    }
    var styleAnchor="text-decoration:none;color:black;"
    var styleLightBorder="border-style:solid;border-width:1px;border-color:#a0a0a0;"

    function swapImage(srcImg, destImg){
        if (ie) { document.getElementById(srcImg).setAttribute("src",imgDir + destImg) }
    }

    function init() {
        if (!ns4)
        {
            if (!ie) { yearNow += 1900; }

            crossobj=(dom)?document.getElementById("calendar").style : ie? document.all.calendar : document.calendar;
            hideCalendar();

            crossMonthObj=(dom)?document.getElementById("selectMonth").style : ie? document.all.selectMonth : document.selectMonth;

            crossYearObj=(dom)?document.getElementById("selectYear").style : ie? document.all.selectYear : document.selectYear;

            monthConstructed=false;
            yearConstructed=false;

            sHTML1="<span id='spanLeft' style='border-style:solid;border-width:1;border-color:#dddddd;cursor:pointer' onmouseover='swapImage(\"changeLeft\",\"left2.gif\");this.style.borderColor=\"white\";window.status=\""+scrollLeftMessage+"\"' onclick='javascript:decMonth()' onmouseout='clearInterval(intervalID1);swapImage(\"changeLeft\",\"left1.gif\");this.style.borderColor=\"#dddddd\";window.status=\"\"' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"StartDecMonth()\",500)'    onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'>&nbsp<IMG id='changeLeft' SRC='"+imgDir+"left1.gif' width=10 height=11 BORDER=0>&nbsp</span>&nbsp;";
            sHTML1+="<span id='spanRight' style='border-style:solid;border-width:1;border-color:#dddddd;cursor:pointer' onmouseover='swapImage(\"changeRight\",\"right2.gif\");this.style.borderColor=\"white\";window.status=\""+scrollRightMessage+"\"' onmouseout='clearInterval(intervalID1);swapImage(\"changeRight\",\"right1.gif\");this.style.borderColor=\"#dddddd\";window.status=\"\"' onclick='incMonth()' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"StartIncMonth()\",500)'    onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'>&nbsp<IMG id='changeRight' SRC='"+imgDir+"right1.gif'   width=10 height=11 BORDER=0>&nbsp</span>&nbsp";
            sHTML1+="<span id='spanMonth' style='border-style:solid;border-width:1;border-color:#dddddd;cursor:pointer' onmouseover='swapImage(\"changeMonth\",\"drop2.gif\");this.style.borderColor=\"white\";window.status=\""+selectMonthMessage+"\"' onmouseout='swapImage(\"changeMonth\",\"drop1.gif\");this.style.borderColor=\"#dddddd\";window.status=\"\"' onclick='popUpMonth()'></span>&nbsp;";
            sHTML1+="<span id='spanYear' style='border-style:solid;border-width:1;border-color:#dddddd;cursor:pointer' onmouseover='swapImage(\"changeYear\",\"drop2.gif\");this.style.borderColor=\"white\";window.status=\""+selectYearMessage+"\"'   onmouseout='swapImage(\"changeYear\",\"drop1.gif\");this.style.borderColor=\"#dddddd\";window.status=\"\"'  onclick='popUpYear()'></span>&nbsp;";

            document.getElementById("caption").innerHTML  = sHTML1;

            bPageLoaded=true;
        }
    }

    function hideCalendar() {
        crossobj.visibility="hidden";
        if (crossMonthObj != null){crossMonthObj.visibility="hidden";}
        if (crossYearObj != null){crossYearObj.visibility="hidden";}

        showElement( 'SELECT' );
        showElement( 'APPLET' );
    }

    function padZero(num) {
        return (num < 10)? '0' + num : num ;
    }

    function constructDate(d,m,y)
    {
        sTmp = dateFormat
        sTmp = sTmp.replace ("dd","<e>")
        sTmp = sTmp.replace ("d","<d>")
        sTmp = sTmp.replace ("<e>",padZero(d))
        sTmp = sTmp.replace ("<d>",d)
        sTmp = sTmp.replace ("mmm","<o>")
        sTmp = sTmp.replace ("mm","<n>")
        sTmp = sTmp.replace ("m","<m>")
        sTmp = sTmp.replace ("<m>",m+1)
        sTmp = sTmp.replace ("<n>",padZero(m+1))
        sTmp = sTmp.replace ("<o>",monthName[m])
        sTmp = sTmp.replace ("yyyy",y)
        sTmp = sTmp.replace ("yy",y.toString().substr(2,2))
        return sTmp
    }

    function closeCalendar() {
        var sTmp

        hideCalendar();
        //ctlToPlaceValue.value =   constructDate(dateSelected,monthSelected,yearSelected.toString().substr(2,2))
        ctlToPlaceValue.value = constructDate(dateSelected,monthSelected,yearSelected.toString())
        calVal=ctlToPlaceValue.value;
    }

    /*** Month Pulldown ***/

    function StartDecMonth()
    {
        intervalID1=setInterval("decMonth()",80)
    }

    function StartIncMonth()
    {
        intervalID1=setInterval("incMonth()",80)
    }

    function incMonth () {
        monthSelected++
        if (monthSelected>11) {
            monthSelected=0
            yearSelected++
        }
        constructCalendar()
    }

    function decMonth () {
        monthSelected--
        if (monthSelected<0) {
            monthSelected=11
            yearSelected--
        }
        constructCalendar()
    }

    function constructMonth() {
        popDownYear()
        if (!monthConstructed) {
            sHTML = ""
            for (i=0; i<12; i++) {
                sName = monthName[i];
                if (i==monthSelected){
                    sName = "<B>" + sName + "</B>"
                }
                sHTML += "<tr><td id='m" + i + "' onmouseover='this.style.backgroundColor=\"#dddddd\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='monthConstructed=false;monthSelected=" + i + ";constructCalendar();popDownMonth();event.cancelBubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
            }

            document.getElementById("selectMonth").innerHTML = "<table width=70 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='white' cellspacing=0 onmouseover='clearTimeout(timeoutID1)'   onmouseout='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"popDownMonth()\",100);event.cancelBubble=true'>" + sHTML + "</table>"

            monthConstructed=true
        }
    }

    function popUpMonth() {
        constructMonth()
        crossMonthObj.visibility = (dom||ie)? "visible" : "show"
        crossMonthObj.left = parseInt(crossobj.left) + 50
        crossMonthObj.top = parseInt(crossobj.top) + 26

        hideElement( 'SELECT', document.getElementById("selectMonth") );
        hideElement( 'APPLET', document.getElementById("selectMonth") );            
    }

    function popDownMonth() {
        crossMonthObj.visibility= "hidden"
    }

    /*** Year Pulldown ***/

    function incYear() {
        for (i=0; i<7; i++){
            newYear = (i+nStartingYear)+1
            if (newYear==yearSelected)
            { txtYear = "&nbsp;<B>" + newYear + "</B>&nbsp;" }
            else
            { txtYear = "&nbsp;" + newYear + "&nbsp;" }
            document.getElementById("y"+i).innerHTML = txtYear
        }
        nStartingYear ++;
        bShow=true
    }

    function decYear() {
        for (i=0; i<7; i++){
            newYear = (i+nStartingYear)-1
            if (newYear==yearSelected)
            { txtYear = "&nbsp;<B>" + newYear + "</B>&nbsp;" }
            else
            { txtYear = "&nbsp;" + newYear + "&nbsp;" }
            document.getElementById("y"+i).innerHTML = txtYear
        }
        nStartingYear --;
        bShow=true
    }

    function selectYear(nYear) {
        yearSelected=parseInt(nYear+nStartingYear);
        yearConstructed=false;
        constructCalendar();
        popDownYear();
    }

    function constructYear() {
        popDownMonth()
        sHTML = ""
        if (!yearConstructed) {

            sHTML = "<tr><td align='center' onmouseover='this.style.backgroundColor=\"white\"' onmouseout='clearInterval(intervalID1);this.style.backgroundColor=\"\"' style='cursor:pointer'   onmousedown='clearInterval(intervalID1);intervalID1=setInterval(\"decYear()\",30)' onmouseup='clearInterval(intervalID1)'>-</td></tr>"

            j = 0
            nStartingYear = yearSelected-3
            for (i=(yearSelected-3); i<=(yearSelected+3); i++) {
                sName = i;
                if (i==yearSelected){
                    sName = "<B>" + sName + "</B>"
                }

                sHTML += "<tr><td id='y" + j + "' onmouseover='this.style.backgroundColor=\"#dddddd\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='selectYear("+j+");event.cancelBubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
                j ++;
            }

            sHTML += "<tr><td align='center' onmouseover='this.style.backgroundColor=\"white\"' onmouseout='clearInterval(intervalID2);this.style.backgroundColor=\"\"' style='cursor:pointer' onmousedown='clearInterval(intervalID2);intervalID2=setInterval(\"incYear()\",30)'   onmouseup='clearInterval(intervalID2)'>+</td></tr>"

            document.getElementById("selectYear").innerHTML = "<table width=44 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='white' onmouseover='clearTimeout(timeoutID2)' onmouseout='clearTimeout(timeoutID2);timeoutID2=setTimeout(\"popDownYear()\",100)' cellspacing=0>"   + sHTML + "</table>"

            yearConstructed = true
        }
    }

    function popDownYear() {
        clearInterval(intervalID1)
        clearTimeout(timeoutID1)
        clearInterval(intervalID2)
        clearTimeout(timeoutID2)
        crossYearObj.visibility= "hidden"
    }

    function popUpYear() {
        var leftOffset

        constructYear()
        crossYearObj.visibility = (dom||ie)? "visible" : "show"
        leftOffset = parseInt(crossobj.left) + document.getElementById("spanYear").offsetLeft
        if (ie)
        {
            leftOffset += 6
        }
        crossYearObj.left = leftOffset
        crossYearObj.top = parseInt(crossobj.top) + 26
    }

    /*** calendar ***/

    function constructCalendar () {
        var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31)

        var dateMessage
        var startDate = new Date (yearSelected,monthSelected,1)
        var endDate
        var colColour="bgcolor=white";
        var bSwitch;
        var nMax;

        if (monthSelected==1)
        {
            endDate = new Date (yearSelected,monthSelected+1,1);
            endDate = new Date (endDate - (24*60*60*1000));
            numDaysInMonth = endDate.getDate()
        }
        else
        {
            numDaysInMonth = aNumDays[monthSelected];
        }

        datePointer = 0
        dayPointer = startDate.getDay() - startAt

        if (dayPointer<0)
        {
            dayPointer = 6
        }

        sHTML = "<table  border=1 cellspacing=0 style='font-family:arial;font-size:10px;'><tr>"

//Set up row of Day Headings

        for (i=0; i<7; i++) {
            sHTML += "<td width='27' align='right' bgcolor='#dddddd'><B>"+ dayName[i].substr(0,3)+"</B></td>"
        }
        sHTML +="</tr><tr>"

//Fill in empty columns before start day
        for ( var i=1; i<=dayPointer;i++ )
        {
           if ((i%2))          
               sHTML += "<td bgcolor='white'>&nbsp;</td>"
           else    
               sHTML += "<td bgcolor='#dddddd'>&nbsp;</td>"
        }   
        if (dayPointer%2)
           bSwitch=false;
        else
           bSwitch=true;   

        for ( datePointer=1; datePointer<=numDaysInMonth; datePointer++ )
        {       
            dayPointer++;           

            if (bSwitch)
                 colColour=" bgcolor='white'";
            else
                 colColour=" bgcolor='#dddddd'";      

            sHTML += "<td align=right" + colColour +  ">"
            sStyle=styleAnchor
            if ((datePointer==odateSelected) && (monthSelected==omonthSelected) && (yearSelected==oyearSelected))
            { sStyle+=styleLightBorder }

            sHint = ""

            var regexp= /\"/g
            sHint=sHint.replace(regexp,"&quot;")

            dateMessage = "onmousemove='window.status=\""+selectDateMessage.replace("[date]",constructDate(datePointer,monthSelected,yearSelected))+"\"' onmouseout='window.status=\"\"' "

            if ((datePointer==dateNow)&&(monthSelected==monthNow)&&(yearSelected==yearNow))
            { sHTML += "<b><a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer+";closeCalendar();'><font color=#ff0000>&nbsp;" + datePointer + "</font>&nbsp;</a></b>"}
            else if (dayPointer % 7 == (startAt * -1)+1) //Sunday
            { sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer + ";closeCalendar();'>&nbsp;<font color=#909090>" + datePointer + "</font>&nbsp;</a>" }
            else
            { sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer + ";closeCalendar();'>&nbsp;" + datePointer + "&nbsp;</a>" }

            bSwitch=!bSwitch

            sHTML += ""
            if ((dayPointer+startAt) % 7 == startAt) { 
                bSwitch=true;
                sHTML += "</tr><tr>" 
            }
        }
//Add on as many empty cells as required to fill row        

        if (dayPointer > 35)
            nMax = 42;
        else
            nMax = 35;

        for ( var i=1; i<=(nMax-dayPointer);i++ )
        {
           if (bSwitch)        
               sHTML += "<td bgcolor='white'>&nbsp;</td>"
           else    
               sHTML += "<td bgcolor='#dddddd'>&nbsp;</td>"
            bSwitch=!bSwitch
        }   

        document.getElementById("content1").innerHTML   = sHTML
        document.getElementById("spanMonth").innerHTML = "&nbsp;" + monthName[monthSelected] + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<IMG id='changeMonth' SRC='/DIMSWEB/images/drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
        document.getElementById("spanYear").innerHTML = "&nbsp;" + yearSelected + "&nbsp;<IMG id='changeYear' SRC='/DIMSWEB/images/drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
    }

    function popUpCalendar(ctl, ctl2, format) {
        var leftpos=0
        var toppos=0

        if (bPageLoaded)
        {

            if ( crossobj.visibility == "hidden" ) {
                ctlToPlaceValue = ctl2
                dateFormat=format;

                formatChar = " "
                aFormat = dateFormat.split(formatChar)
                if (aFormat.length<3)
                {
                    formatChar = "/"
                    aFormat = dateFormat.split(formatChar)
                    if (aFormat.length<3)
                    {
                        formatChar = "."
                        aFormat = dateFormat.split(formatChar)
                        if (aFormat.length<3)
                        {
                            formatChar = "-"
                            aFormat = dateFormat.split(formatChar)
                            if (aFormat.length<3)
                            {
                                // invalid date format
                                formatChar=""
                            }
                        }
                    }
                }


                tokensChanged = 0
                if ( formatChar != "" )
                {
                    // use user's date
                    aData = ctl2.value.split(formatChar)

                    for (i=0;i<3;i++)
                    {
                        if ((aFormat[i]=="d") || (aFormat[i]=="dd"))
                        {
                            dateSelected = parseInt(aData[i], 10)
                            tokensChanged ++
                        }
                        else if ((aFormat[i]=="m") || (aFormat[i]=="mm"))
                        {
                            monthSelected = parseInt(aData[i], 10) - 1
                            tokensChanged ++
                        }
                        else if (aFormat[i]=="yyyy")
                        {
                            yearSelected = parseInt(aData[i], 10)
                            tokensChanged ++
                        }
                        else if (aFormat[i]=="yy")
                        {
                            if (aData[i]>50)
                            {
                               tempYear = parseInt(1900 + parseInt(aData[i]))
                            }
                            else
                            {
                               tempYear = parseInt(2000 + parseInt(aData[i]))
                            }
                            yearSelected = parseInt(tempYear, 10)
                            tokensChanged ++
                        }
                        else if (aFormat[i]=="mmm")
                        {
                            for (j=0; j<12; j++)
                            {
                                if (aData[i]==monthName[j])
                                {
                                    monthSelected=j
                                    tokensChanged ++
                                }
                            }
                        }                       
                    }
                }

                if ((tokensChanged!=3)||isNaN(dateSelected)||isNaN(monthSelected)||isNaN(yearSelected))
                {
                    dateSelected = dateNow
                    monthSelected = monthNow
                    yearSelected = yearNow
                }

                odateSelected=dateSelected
                omonthSelected=monthSelected
                oyearSelected=yearSelected

                aTag = ctl
                do {
                    aTag = aTag.offsetParent;

                    if(aTag.offsetLeft>=600){
                        leftpos += (aTag.offsetLeft-200);
                    }
                    else{
                        leftpos += aTag.offsetLeft;
                    }

                    toppos += aTag.offsetTop;
                } while(aTag.tagName!="BODY");

                crossobj.left = fixedX==-1 ? ctl.offsetLeft + leftpos : fixedX
                crossobj.top = fixedY==-1 ? ctl.offsetTop + toppos + ctl.offsetHeight + 2 : fixedY
                constructCalendar (1, monthSelected, yearSelected);
                crossobj.visibility=(dom||ie)? "visible" : "show"

                hideElement( 'SELECT', document.getElementById("calendar") );
                hideElement( 'APPLET', document.getElementById("calendar") );           

                bShow = true;
            }
            else
            {
                hideCalendar()
                if (ctlNow!=ctl) {popUpCalendar(ctl, ctl2, format);}
            }
            ctlNow = ctl;
        }
        return calVal;
    }

    document.onkeypress = function hidecal1 () { 
        if (event.keyCode==27) 
        {
            hideCalendar();
        }
    }
    document.onclick = function hidecal2 () {       
        if (!bShow)
        {
            hideCalendar();
        }
        bShow = false
    }

    if(ie)  
    {
        init()
    }
    else
    {
        window.onload=init
    }

    function Navigate(obj,strURL,plsEnterUDate,noPastUDate,notValidYr){     
    var index = obj.getElementById("selLocationCode").selectedIndex;
    var selLocation = obj.getElementById("selLocationCode").options(index).value;
    var selCodeDesc = selLocation.split(",");
    obj.getElementById("hdLocationCode").value=selCodeDesc[0];

    obj.getElementById("hdLocationDesc").value=selCodeDesc[1];



    //frmLocUnavailAdd_onSubmit(obj);
        if(frmLocUnavailAdd_onSubmit(obj,plsEnterUDate,noPastUDate,notValidYr))
        {
            obj.frmLocUnavailAdd.action = strURL;
            obj.frmLocUnavailAdd.submit();        
        }
    }

    function Navigate1(obj,strURL,plsEnterUDate,noPastUDate,notValidYr){

    //frmLocUnavailAdd_onSubmit(obj);
    if(frmLocUnavailAdd_onSubmit(obj,plsEnterUDate,noPastUDate,notValidYr))
        {
          obj.frmLocUnavailAdd.action = strURL;
          obj.frmLocUnavailAdd.submit();          
        }
    }

</script>

var pathURL='';
var fixedX=-1;//x位置(-1,如果显示在控件下方)
变量fixedY=-1;//y位置(-1,如果显示在控制下方)
var startAt=1;//0-星期日;1-星期一
变量showWeekNumber=0;//0-不显示;1-表演
var showToday=0;//0-不显示;1-表演
var imgDir=“/DIMSWEB/images/”;//图像目录。。。e、 g.var imgDir=“/img/”
变量titlebar=“#969798”;
var highlight=“#FFCC99”;
var gotoString=“转到当前月份”;
var todayString=“今天是”;
var weekString=“Wk”;
var scrollLeftMessage=“单击可滚动到上个月。按住鼠标按钮可自动滚动。”;
var scrollRightMessage=“单击可滚动到下个月。按住鼠标按钮可自动滚动。”;
var selectMonthMessage=“单击以选择月份。”;
var selectYearMessage=“单击以选择年份。”;
var selectDateMessage=“选择[日期]作为日期。”;//不要替换[日期],它将被日期替换。
变量crossobj、crossMonthObj、crossYearObj、monthSelected、yearSelected、omonthSelected、oyearSelected、odateSelected、monthConstructed、yearConstructed、intervalID1、intervalID2、timeoutID1、timeoutID2、CttoPlaceValue、ctlNow、dateFormat、nStartingYear;
var bPageLoaded=false;
var ie=document.all;
var dom=document.getElementById;
var ns4=document.layers;
var today=新日期();
var dateNow=today.getDate();
var monthNow=today.getMonth();
var drawnow=today.getFullYear();
var imgsrc=新数组(“drop1.gif”、“drop2.gif”、“left1.gif”、“left2.gif”、“righ1.gif”、“righ2.gif”);
var img=新数组();
var bShow=假;
加尔瓦尔变种;
/*隐藏和隐藏
//Subhadip修改:2006年12月7日
文件编号:“”;
}
//var monthName=新数组(“一月”、“二月”、“三月”、“四月”、“五月”、“六月”、“七月”、“八月”、“九月”、“十月”、“十一月”、“十二月”)
var jan_key=“”;
var feb_key=“”;
var mar_key=“”;
var april_key=“”;
var may_key=“”;
var june_key=“”;
var july_key=“”;
var aug_key=“”;
var sep_key=“”;
var oct_key=“”;
var nov_key=“”;
var dec_key=“”;
var sun_key=“”;
var mon_key=“”;
var tue_key=“”;
var wed_key=“”;
var thur_key=“”;
var fri_key=“”;
var sat_key=“”;
var monthName=新数组(一月键、二月键、三月键、四月键、五月键、六月键、七月键、八月键、九月键、十月键、十一月键、十二月键);
如果(startAt==0)
{
dayName=新数组(太阳键、周一键、周二键、周三键、周四键、周五键、周六键)
}
其他的
{
dayName=新数组(周一、周二、周三、周四、周五、周六、周日)
}
var styleAnchor=“文本装饰:无;颜色:黑色;"
var styleLightBorder=“边框样式:实心;边框宽度:1px;边框颜色:#A0;"
函数交换页(srcImg、destImg){
if(ie){document.getElementById(srcImg.setAttribute(“src”,imgDir+destImg)}
}
函数init(){
如果(!ns4)
{
如果(!ie){earthow+=1900;}
crossobj=(dom)?document.getElementById(“日历”)。样式:ie?document.all.calendar:document.calendar;
汗腺();
crossMonthObj=(dom)?document.getElementById(“selectMonth”)。样式:ie?document.all.selectMonth:document.selectMonth;
crossYearObj=(dom)?document.getElementById(“selectYear”)。样式:ie?document.all.selectYear:document.selectYear;
monthConstructed=false;
年份=假;
sHTML1=“ ;”;
sHTML1+=“  ”;
sHTML1+=“”;
sHTML1+=“”;
document.getElementById(“caption”).innerHTML=sHTML1;
bPageLoaded=true;
}
}
函数hideCalendar(){
crossobj.visibility=“隐藏”;
如果(crossMonthObj!=null){crossMonthObj.visibility=“hidden”}
如果(crossYearObj!=null){crossYearObj.visibility=“hidden”}
showElement(‘选择’);
showElement('APPLET');
}
函数padZero(num){
返回值(num<10)?“0”+num:num;
}
函数构造日期(d,m,y)
{
sTmp=日期格式
sTmp=sTmp.replace(“dd”,“”)
sTmp=sTmp.replace(“d”和“”)
sTmp=sTmp.replace(“,padZero(d))
sTmp=sTmp.replace(“,d)
sTmp=sTmp.replace(“mmm”和“”)
sTmp=sTmp.replace(“mm”,“”)
sTmp=sTmp.replace(“m”和“”)
sTmp=sTmp.replace(“,m+1)
sTmp=sTmp.replace(“,padZero(m+1))
sTmp=sTmp.replace(“,monthName[m])
sTmp=sTmp.replace(“yyyy”,y)
sTmp=sTmp.replace(“yy”,y.toString().substr(2,2))
返回sTmp
}
函数closeCalendar(){
var-sTmp
汗腺();
//ctlToPlaceValue.value=constructDate(已选择日期、已选择月、已选择年)。toString().substr(2,2))
托普莱塞瓦酒店
crossobj=(dom)?document.getElementById("calendar").style : ie? document.all.calendar : document.calendar;