紧急求助大家关于用Javascript计算日期的问题,谢谢
我编写了一个用Javascript计算日期的函数,例如现在日期为“2007-06-04”,周期为“7个月”,计算有效日期应为“2008-01-03”,但是我编写的程序没有既没有计算,结果也没有显示出来,请大家帮我看看是什么问题,帮我修改一下,谢谢
<script language= "JavaScript " >
function youxiaoriqi()
{ document.form1.jdzq.value = document.form1.jdzq1.value
var jiandingriqi=document.form1.jdrq.value;
var diff=document.form1.jdzq.value;
var year=jiandingriqi.getyear();
var month=jiandingriqi.getmonth();
var day=jiandingriqi.getday();
var numDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var isLeap = false;
var newyear = year;
var newmonth = month - 1;
var n = numDays[newmonth];
var newday = day;
var newdiff = diff;
var ln;
if (newmonth == 0)
ln = 31;
else if(newmonth == 11)
ln = 31;
else
ln = numDays[newmonth + 1];
if (diff != 0)...{
//判断是否润年
if (year % 4 == 0)...{
if (year % 100 != 0)
isLeap = true;
else...{
if (year % 40