<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>飞石日志管理系统</title>
<link href="css/base.css" rel="stylesheet" type="text/css" />
<link href="css/index.css" rel="stylesheet" type="text/css" /></head><body><div id="top"></div>
<div id="date_zone" class="mid">
<table id="tt" border="1">
    </table>  
</div><a id="a">123</a> </body>
</html>
<script type="text/javascript">var date=new Date();
year=date.getYear();
month=date.getMonth()+1;
day=date.getDate();
week=date.getDay();//查找本月的第一天是星期几
month_first=new Date(month+'-01-'+year)//查找上月的最后一天是几号
pre_month_last=new Date(month_first.getTime()-1000*60*60*24).getDate();
//查找上月的最后一天是星期几
pre_month_week=new Date(month_first.getTime()-1000*60*60*24).getDay();
//通过查找下月第一天减去一天返回本月最后一天
if(month+1>12)
{
next_month=1;//获取下个月月份
year=year+1;//获取下个月所在年份
}
else
{
next_month=month+1
}
next_month_first=new Date(next_month+'-01-'+year)//获取下个月第一天
time=next_month_first.getTime()-1000*60*60*24;//返回本月最后一天的时间戳
month_last=new Date(time).getDate();//返回本月最后一天的日期
first=pre_month_last-pre_month_week+1;//第一行的第一个数字是:
//求显示行数:
remain=7-(pre_month_week+month_last)%7;//下月在本页面显示的日期
//把当前界面显示的数字按顺序存入数组
arr=[];
var k=0;
for(i=first;i<first+pre_month_week;i++)
{
arr[k]=i;
k++;
}
for(i=1;i<=month_last;i++)
{
arr[k]=i;
k++;
}
for(i=1;i<=remain;i++)
{
arr[k]=i;
k++;
}
var tt=document.getElementById("tt");
html='';
k=0;//重新用一下k.呵呵.可换成其他变量
for(i=0;i<(arr.length/7);i++)
{
html+='<tr>';
for(j=0;j<7;j++)
{
html+='<td><a>';
html+=arr[k];
html+='</a></td>';
k++;
}
html+='</tr>'
}tt.innerHTML=1;
<为什么最后一行报错呢,在ie中无法显示,但是ie10特殊可以显示,谷歌也好使.tt是个对象,我alert了 好奇怪?jsjavascript