再把问题说一下吧,怕没说清楚..一个文本框,的onfocus事件上,我使用了梅花雨的JS控件,选择结束后,日期格式是以yyyy-mm-dd的格式显示的...BOSS要求文本框的格式必需是mm-dd-yyyy  如何解决??

解决方案 »

  1.   

    "2007-04-04".replace(/(\d{4})-(\d{2})-(\d{2})/, "$2-$3-$1")
    像上面这样处理下,就好了。
      

  2.   

    找到源代码中给text赋值赋值的段落照着改...
      

  3.   

    function returnDate() //根据日期格式等返回用户选定的日期
    {
        if(WebCalendar.objExport)
        {
            var returnValue;
            var a = (arguments.length==0) ? WebCalendar.day[this.id.substr(8)].split("/") : arguments[0].split("/");
            var d = WebCalendar.format.match(/^(\w{4})(-|\/|.|)(\w{1,2})\2(\w{1,2})$/);
            if(d==null){alert("你设定的日期输出格式不对!\r\n\r\n请重新定义 WebCalendar.format !"); return false;}
            var flag = d[3].length==2 || d[4].length==2; //判断返回的日期格式是否要补零
            returnValue = flag ? a[2] +d[2]+ appendZero(a[1]) +d[2]+ appendZero(a[0]) : a[2] +d[2]+ a[1] +d[2]+ a[0];
            if(WebCalendar.timeShow)
            {
                var h = new Date().getHours(), m = new Date().getMinutes(), s = new Date().getSeconds();
                returnValue += flag ? " "+ appendZero(h) +":"+ appendZero(m) +":"+ appendZero(s) : " "+  h  +":"+ m +":"+ s;
            }

            WebCalendar.objExport.value = returnValue.replace(/(\d{4})-(\d{2})-(\d{2})/, "$2-$3-$1");
            hiddenCalendar();
        }
    }