var d = new Date();
var newd = d + 24*60*60*7;
alert(newd.getDate());
var newd = d + 24*60*60*7;
alert(newd.getDate());
解决方案 »
- 时间脚本和3c标准不符合,求解
- 如何根据name和value选中radio
- javascript的小问题
- 奇怪,textarea不能显示完全部内容?
- firefox中disablediv.style.width = document.body.scrollWidth没有执行
- 关于保留计算结果有效位数的问题
- 我动态输出flash代码,但是变量无法赋值
- javascript弹出式菜单难题!!!
- js调用百度API,GPS经纬度转换成百度地图经纬度,用BMap.Convertor.translate不能及时转换问题,求大神帮忙。
- javascript 如何实现 截取URL中的参数后.批量赋值
- 在包含多个Iframe的页面中分别打印每个iFrame里的src的页面
- js取得如何asp文件response.write值
var msize = new Array(2,1,0,1,0,1,0,1,1,0,1,0,1);
function MyDate(ayear,amonth,adate)
{
this.year = ayear;
this.month = amonth;
this.date = adate;
this.nextday = DoGoNextDay_MyDate;
this.prevday = DoGoPrevDay_MyDate;
this.getdate = DoGetDate_MyDate;
}
function DoGetDate_MyDate(){ return (this.year + "年" + this.month + "月" + this.date + "日")}
function DoGoNextDay_MyDate()
{
this.date ++;
maxmonth = (msize[this.month]==1)?31:30;
maxmonth = (this.month==2)?((this.year%4==0)?29:28):maxmonth;
if(this.date>maxmonth)
{
this.month++;
this.date = 1;
if(this.month>12)
{
this.year++;
this.month = 1;
this.date = 1;
}
}
}
function DoGoPrevDay_MyDate()
{
this.date --;
if(this.date==0)
{
this.month--;
if(this.month)
{
if(msize[this.month]) this.date = 31;
else
{
this.date = 30;
if(this.month == 2) this.date = 28;
if(this.year%4==0) this.date = 29;
}
}
else
{
this.year--;
this.month = 12;
this.date = 12;
}
}
}
</script><script>
function add(myday)
{
today= new Date();
abc = new MyDate(today.getFullYear(),today.getMonth()+1,today.getDate());
for(n=0;n<myday;n++)
abc.nextday();
document.all.newday.value=abc.getdate();
}
</script>
<input type=text name=afterday onblur=add(this.value)>日后是<input type=text name=newday readOnly>