Js为Tr添加onmouseover事件
jquery加入到工程中(见csdn空间6/js/jquery.js)
<!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>
<script src="/js/jquery.js"></script>
<script>
$(document).ready(function(){
$('#data tbody tr').hover(
function(){
$(this).addClass('bgC1');
},
function()
{
$(this).removeClass('bgC1');
}
);
})
</script>
<style>
.bgC1
{
color: #000000;
background-color:#E7FAFE;
}
</style>
</head>
<body>
<table id="data">
<caption>
书籍列表
</caption>
<thead>
<tr>
<th>书名</th>
<th>dsfdf</th>
<th>sdfsdf</th>
<th>sdfdfssdf</th>
</tr>
</thead>
<tbody>
<tr>
<td>dfsdsfsdf</td>
<td>dsfdf</td>
<td>dsfsdf</td>
<td>dsfsdfsdfa</td>
</tr>
<tr>
<td>sdfsdf</td>
<td>sdsdf</td>
<td>dfssdf</td>
<td>dsfdfs</td>
</tr>
<tr>
<td>sdfdfsdf</td>
<td>sdfdfs</td>
<td>sdfsdf</td>
<td>dfsdfs</td>
</tr>
</tbody>
</table>
</body>
</html>
</body>
</html>