“鼠标放过”要用“onmouseover”这个
“onmousemove”是鼠标移动的
class的效果你已经定义了吧?(那就不用说了)
“this.class='red1' ”,语法错了,所以没有效果
应该用:this.className='red1'
这个“className”的“N”一定要大写,否则也没有效果
例:
<tr onmouseover="this.className='red1'" onmouseout="this.className='恢复的Class名称'" class="red" >
<!doctype html><html lang="zh-cn">
<head>
<meta http-equiv="content-type" content="text/htmlcharset=utf-8" />
<title>Document</title>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<style type="text/css">
.className { background-color: #333}
</style>
</head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<th scope="col">a</th>
<th scope="col">b</th>
<th scope="col">c </th>
<th scope="col">d </th>
</tr>
<tr><td colspan="4">e</td></tr>
<tr>
<td colspan="2">f</td>
<td colspan="2">g</td>
</tr>
<tr> <td colspan="4">h</td> </tr>
<tr>
<td>j</td>
<td>k</td>
<td>l</td>
<td>m</td>
</tr>
</table>
<script type="text/javascript">
$("td[colspan='4']").each(function(){
$(this).addClass('className')
})
//所有th
$('th').each(function(){
$(this).addClass('className')
})
</script>
</body>
</html>
//css 是不是没写啊
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)