日期:2014-05-17  浏览次数:20898 次

css表格鼠标滑动
分享之...



---------------------
HTML:

<!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>
<style>
.datalist{
border:1px solid #0058a3;
font-family:Arial;
border-collapse:collapse;
background-color:#eaf5ff;
font-size: 14px;
}

.datalist th{
border:1px solid #0058a3;
background-color:#4bacff;
color:#FFFFFF;
font-weight:bold;
padding-top:4px;
padding-bottom:4px;
padding-left:12px;
padding-right:12px;
text-align:center;
}

.datalist td{
border:1px solid #0058a3;
text-align:left;
padding-top:4px;
padding-bottom:4px;
padding-left:10px;
padding-right:10px;
}

.datalist tr:hover, .datalist tr.altrow{
background-color:#c4e4ff;
}
</style>
</head>

<body>
<table class="datalist" summary="list of members in EE Studay">
<tr>
<th>Name</th>
<th>Class</th>
<th>Birthday</th>
<th>Address</th>
<th>Mobile</th>
</tr>
<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>

<tr>
	<td>isaac</td>
	<td>W13</td>
	<td>Jun 24h</td>
	<td>Cancer</td>
	<td>1118159</td>
</tr>
</table>
<script type="text/javascript">
	var rows = document.getElementsByTagName("tr");
	for(var i=0; i<rows.length; i++){
		rows[i].onmouseover = function(){
			this.className