calendar,checkDate,formatDate

var sMon = new Array(12);
 sMon[0] = "Jan"
 sMon[1] = "Feb"
 sMon[2] = "Mar"
 sMon[3] = "Apr"
 sMon[4] = "May"
 sMon[5] = "Jun"
 sMon[6] = "Jul"
 sMon[7] = "Aug"
 sMon[8] = "Sep"
 sMon[9] = "Oct"
 sMon[10] = "Nov"
 sMon[11] = "Dec"

function calendar(t) {
 var sPath = "../include/calendar1.htm";
 strFeatures = "dialogWidth=206px;dialogHeight=206px;center=yes;help=no;status=no";
 st = t.value;
 sDate = showModalDialog(sPath,st,strFeatures);
 t.value = formatDate(sDate, 0);
 
}

function calendar_ym(t) {
 var sPath = "../include/calendar3.htm";
 strFeatures = "dialogWidth=206px;dialogHeight=206px;center=yes;help=no;status=no";
 st = t.value;
 sDate = showModalDialog(sPath,st,strFeatures);
 t1 = formatDate(sDate, 0);
 t.value=t1.substr(0,7);
}

function checkDate(t) {
 dDate = new Date(t.value);
 if (dDate == "NaN") {t.value = ""; return;}

 iYear = dDate.getFullYear()

 if ((iYear > 1899)&&(iYear < 1950)) {

  sYear = "" + iYear + ""
  if (t.value.indexOf(sYear,1) == -1) {
   iYear += 100
   sDate = (dDate.getMonth() + 1) + "/" + dDate.getDate() + "/" + iYear
   dDate = new Date(sDate)
  }
 }

 

 t.value = formatDate(dDate);
}

function formatDate(sDate) {
 var sScrap = "";
 var dScrap = new Date(sDate);
 if (dScrap == "NaN") return sScrap;
 
 iDay = dScrap.getDate();
 iMon = dScrap.getMonth();
 iYea = dScrap.getFullYear();

//らのる玡0
 if (iDay < 10) {
  iDay = "0" + iDay;
  }

 iMon = iMon + 1;

 if (iMon <= 9 ) {
 iMon = "0" + iMon;
 }

 sScrap = iYea + "/" + iMon + "/" + iDay ;
// alert (sScrap);
 return sScrap;
}
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

rjzou2006

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值