<!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>
<style type="text/css">
.datalist{
border:1px solid #0058a3;
font-family:Arial, Helvetica, sans-serif;
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;
}
.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>
<script language="javascript">
var rows = document.getElementsByTagName('tr');
for (var i=0;i<rows.length;i++){
rows[i].onmouseover = function(){ //鼠标在行上面的时候
this.className += 'altrow';
}
rows[i].onmouseout = function(){ //鼠标离开时
this.className = this.className.replace('altrow','');
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>鼠标经过时变色的表格</title>
</head>
<body>
<table class="datalist" summary="list op members in EE Studay">
<tr><th>Name</th>
<th>Class</th>
<th>Birthday</th>
<th>Constallinon</th>
<th>Mobile</th>
</tr>
<tr>
<td>isaac</td>
<td>w13</td>
<td>Jun 24th</td>
<td>Cancer</td>
<td>1118159</td>
</tr>
<tr>
<td>lightyear</td>
<td>W311</td>
<td>Mar 23th</td>
<td>Aries</td>
<td>1002908</td></tr>
</table>
</body>
</html>
鼠标经过时变色的表格
最新推荐文章于 2021-06-04 19:08:28 发布