function disDate(oDate,iDate){
var ms=oDate.getTime();
ms-=iDate*24*60*60*1000; //这个地方你写错了,不是oDate,是你的参数iDate.
alert(ms);
return new Date(ms);
}
var iBeijing=new Date(2008,7,8);
var iNum=100;
var oMyDate=disDate(iBeijing,iNum);
document.write(oMyDate.getFullYear()+"年"+(oMyDate.getMonth()+1)+"月"+oMyDate.getDate()+"日"+"距离"+iBeijing.getFullYear()+"年"+(iBeijing.getMonth()+1)+"月"+iBeijing.getDate()+"日"+iNum+"天");
结果如下: