javascript显示表单中的日期

来源:百度知道 编辑:UC知道 时间:2024/09/22 18:29:09
想在表单中加入两个日期,
<input type=calendar name='residebidetime' size='15' id=dc1 value='今天日期'>
<input type=calendar name='resideleavetime' size='15' id=dc2 value='明天日期'>
格式是2009-4-16
请问要怎么写呀

写个javascript函数

now=new Date(); //读取当前日期
year=now.getYear();
month=now.getMonth()+1;
day=now.getDate();
time_str=year+"-"+month+"-"+day+"- ";

residebidetime的值设成time_str

明天加个1就行了,要是到了月底,自己判断一下