有段javascript代码很困惑,经过不断的查资料,终于弄懂了!呵呵! Code<script type="text/javascript">var date=new Date();function initArray(){ this.length=initArray.arguments.length; for(var i=0;i<this.length;i++){ this[i]=initArray.arguments[i]; }}var d=new initArray('星期日','星期一','星期二','星期三','星期四','星期五','星期六');//Firfox浏览器显示年是由getYear()获取当前年减去1900年document.write((date.getYear()>1900?date.getYear():date.getYear()+1900)+"年");document.write(date.getMonth()+1+"月");document.write(date.getDate()+"日 ");document.write(d[date.getDay()]);</script>因为JavaScript并不支援数组,所以要用下面的这段代码来定义初始化数组。function initArray(){ this.length=initArray.arguments.length; for(var i=0;i<this.length;i++){ this[i]=initArray.arguments[i]; }}