<script language="javascript" type="text/javascript">
//获取两个日期相差的天数
var dt1 = new Date("2008/06/19");
var dt2 = new Date("2008/08/08");
var days = parseInt(Math.abs(dt2 - dt1 ) / 1000 / 60 / 60 /24);
alert("今天距北京奥运还有"+days +"天!");
//给某个日期添加天数
function addDaysToDate(myDate,days)
{
return new Date(myDate.getTime() + days*24*60*60*1000);
}
var a = addDaysToDate(dt1,50);
alert(a.getFullYear()+"年"+(a.getMonth() + 1)+"月"+a.getDate()+"日");
</script>