RSS
热门关键字:  java  Ajax  JSP  JSF  Struts
当前位置 : 首页>Java>列表

日历控件

来源: 作者: 时间:2007-09-18 点击:

{
returnValue = yy + appendZero(mm) + appendZero(dd);
if(WebCalendar.timeShow == true)
{
returnValue += appendZero(h) + appendZero(m) + appendZero(s);
}
}
else if(/^(y{4})(-|\/)(M{1,2})\2(d{1,2})$/.test(WebCalendar.format) ||
/^(y{4})(-|\/)(M{1,2})(-|\/)(d{1,2}) HH:mm:ss$/.test(WebCalendar.format))
//"-","/"间隔格式
{
var d;
if(/^(y{4})(-|\/)(M{1,2})\2(d{1,2})$/.test(WebCalendar.format))
d = WebCalendar.format.match(/^(\w{4})(-|\/)(\w{1,2})\2(\w{1,2})$/);
else
d = WebCalendar.format.match(/^(\w{4})(-|\/)(\w{1,2})\2(\w{1,2}) HH:mm:ss$/);

if(d==null)
{
alert("你设定的日期输出格式不对!\r\n\r\n请重新定义 WebCalendar.format !");
return false;
}
var flag = d[3].length==2 || d[4].length==2; //判断返回的日期格式是否要补零
returnValue = flag ? yy +d[2]+ appendZero(mm) +d[2]+ appendZero(dd) : yy +d[2]+ mm +d[2]+ dd;
if(WebCalendar.timeShow == true)
{
returnValue += flag ? " "+ appendZero(h) +":"+ appendZero(m) +":"+ appendZero(s) : " "+ h +":"+ m +":"+ s;
}
}
else if(/^(y{4})(年)(M{1,2})(月)(d{1,2})(日)$/.test(WebCalendar.format) ||
/^(y{4})(年)(M{1,2})(月)(d{1,2})(日)(HH时mm分ss秒)$/.test(WebCalendar.format))
//中文格式
{
var d;
if(/^(y{4})(年)(M{1,2})(月)(d{1,2})(日)$/.test(WebCalendar.format))
d = WebCalendar.format.match(/^(y{4})(年)(M{1,2})(月)(d{1,2})(日)$/);
else
d = WebCalendar.format.match(/^(y{4})(年)(M{1,2})(月)(d{1,2})(日)(HH时mm分ss秒)$/);
if(d==null)
{
alert("你设定的日期输出格式不对!\r\n\r\n请重新定义 WebCalendar.format !");
return false;
}
var flag = d[3].length==2 || d[5].length==2; //判断返回的日期格式是否要补零
returnValue = flag ? yy + "年" + appendZero(mm) + "月" + appendZero(dd) + "日" : yy + "年" + mm + "月" + dd + "日";
if(WebCalendar.timeShow == true)
{
var h = WebCalendar.thisHour, m = WebCalendar.thisMinute, s = WebCalendar.thisSecond;
returnValue += flag ? appendZero(h) +"时"+ appendZero(m) + "分" + appendZero(s) + "秒" : h +"时"+ m + "分" + s + "秒";
}
}
else
//默认的返回格式
{
if(/^(y{4})(-)(M{1,2})\2(d{1,2}) HH:mm:ss$/.test(WebCalendar.format))
{
var h = WebCalendar.thisHour, m = WebCalendar.thisMinute, s = WebCalendar.thisSecond;
returnValue = yy + "-" + mm + "-" + ss;
returnValue += " " + appendZero(h) +":"+ appendZero(m) + ":" + appendZero(s);
}
else
alert("你设定的日期输出格式不对!\r\n\r\n请重新定义 WebCalendar.format !");
}
WebCalendar.objExport.value = returnValue;
hiddenCalendar();
}
else
{
alert("你设定的日期输出位置不对!\r\n\r\n请重新定义 WebCalendar.objExport !");
}
}

function document.onclick()
{
if(WebCalendar.eventSrc != window.event.srcElement)
hiddenCalendar();
}

/**
 *此函数把yyyMMdd或yyyyMMddHHmmss转成各种支持的格式
 *参数说明:
 *    data:待转换的日期 
 *    format:需要转换成的日期格式 
 *
 */
function formatSpecial(data,format)
{


if(WebCalendar.isOpen != true)
{
if(arguments[1] == undefined || arguments[1] == "undefined")
WebCalendar.format = "yyyy-MM-dd HH:mm:ss";
else
WebCalendar.format = arguments[1];

if(/^(y{4})(-|\/)(M{1,2})\2(d{1,2})$/.test(WebCalendar.format))
{
WebCalendar.dateReg = /^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2})$/;
WebCalendar.timeShow = false;
}
else if(/^(y{4})(年)(M{1,2})(月)(d{1,2})(日)$/.test(WebCalendar.format))
{
WebCalendar.dateReg = /^(\d{4})年(\d{1,2})月(\d{1,2})日$/;
WebCalendar.timeShow = false;

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
Google Adsense
相关文章