论坛首页 Web前端技术论坛

css表格鼠标滑动

浏览 2191 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2010-06-30  
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 += 'altrow';
		}
		rows[i].onmouseout = function(){
			this.className = this.className.replace('altrow');
		}
	}
</script>
</body>
</html>
  • 大小: 75.3 KB
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics