js代码提示脚本有误,高手帮忙修改下!解决方法

js代码提示脚本有误,高手帮忙修改下!!!!
运行js脚本提示style为空或不是对象,js脚本如下,请帮忙修改下:
<script language="javascript">
window.onload=function showtable(){
  var tablename=document.getElementById("mytable");
  var li=tablename.getElementsByTagName("tr");
  for (var i=0;i<=li.length;i++){
  if(i%2==0){
  li[i].style.backgroundColor="#F3F8F7";
  li[i].onmouseout=function(){
  this.style.backgroundColor="#F3F8F7"
  }
  }else{
  li[i].style.backgroundColor="#fff";
  li[i].onmouseout=function(){
  this.style.backgroundColor="#fff"
  }
  }
  li[i].onmouseover=function(){
  this.style.backgroundColor="#beeeff";
  }
  }
}
</script>

 <table id="mytable" width="99%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
  <td width="18%上传个人照片</td>
  <td width="82%">&nbsp;</td>
  </tr>
  <tr>
  <td >个人简介</td>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td >联系电话</td>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td >&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
</table>


------解决方案--------------------
for (var i=0;i<=li.length-1;i++){
}

-1下 。
下标越界了 。
------解决方案--------------------
<td width="18%">上传个人照片</td>

这个标签没闭合 。
------解决方案--------------------
for (var i=0;i<=li.length;i++){
改为
for (var i=0;i<li.length;i++){


<td width="18%">上传个人照片</td>

这个标签没闭合
------解决方案--------------------
var tablename=document.getElementById("mytable");
var li=tablename.rows;
for (var i=0;i<li.length;i++)
{
if(i%2==0){
li[i].style.backgroundColor="#F3F8F7";
li[i].onmouseout=function(){
this.style.backgroundColor="#F3F8F7"
}
}else{
li[i].style.backgroundColor="#fff";
li[i].onmouseout=function(){
this.style.backgroundColor="#fff"
}
}
li[i].onmouseover=function(){
this.style.backgroundColor="#beeeff";
};
}
------解决方案--------------------

for (var i=0;i<=li.length;i++){

红色部分去掉。。。。
------解决方案--------------------
<!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=gb2312" />
<title>无标题文档</title>
</head>

<body>
运行js脚本提示style为空或不是对象,js脚本如下,请帮忙修改下:
<script language="javascript">
window.onload=function showtable(){
var tablename=document.getElementById("mytable");