<style type="text/css">
table{
color:#565;
font:Arial, Helvetica, sans-serif;
}
td{
border-bottom:2px solid #b3de94;
border-top:3px solid #fff;
padding:9px;
}
tr:hover,td.hover{
background-color:#595;
color:#fff;
}
tr{
background-color:#dfc;}
</style>
</head>
<body>
<table summary="book list" >
<caption>Book List</caption>
<tr>
<td>title</td>
<td>adddd</td>
<td>tdddd</td>
<td>sdsfd</td>
<td>sfgsd</td>
</tr>
<tr>
<td>tttt</td>
<td>adddd</td>
<td>tdddd</td>
<td>sdsfd</td>
<td>sfgsd</td>
</tr>
<tr>
<td>eeee</td>
<td>adddd</td>
<td>tdddd</td>
<td>sdsfd</td>
<td>sfgsd</td>
</tr>
<tr>
<td>wwww</td>
<td>adddd</td>
<td>tdddd</td>
<td>sdsfd</td>
<td>sfgsd</td>
</tr>
<tr>
<td>qqqqq</td>
<td>adddd</td>
<td>tdddd</td>
<td>sdsfd</td>
<td>sfgsd</td>
</tr>
</table>
<script language="javascript">
var cells=document.getElementsByTagName('td');//cells是一个行的数组帮当前页中所有的单元格
for(var i=0;i<cells.length;i++)
{
cells[i].onmouseover=function()//鼠标指针在行上面的时候
{
this.className='hover';
for(
var j=0;j<cells.length;j++
)
if(cells[j]==this){
cells[j%5].className='hover';
cells[j-j%5].className='hover';
}
//上变色
//左变色
}
cells[i].onmouseout=function()//鼠标指针离开时
{
this.className='';
for(
var j=0;j<cells.length;j++
)
if(cells[j]==this){
cells[j%5].className='';
cells[j-j%5].className='';
}
//上恢复
//左恢复
}
}
</script>
</body>