由年限和起始日期计算结束日期函数

acseskd Post at 2014/11/21 23:12:00
function GetEndData(nx,kssj, obj)
{
if (obj.value.length == 0)
{
var numnx=document.all(nx).value;
var numkssj=document.all(kssj).value
if(numnx.length>0 && numkssj.length>0)
{
var ks=numkssj.replace(/-/g,"/");
var tm = new Date(ks);
var year = parseInt(tm.getYear()) + parseInt(numnx);
var month = tm.getMonth() + 1;
var day = tm.getDate() - 1;
obj.value = year + "-" + month + "-" + day;
}
}
}

已有 -1 位网友发表了看法