<table width="1098" height="87" border='0' cellpadding='0' cellspacing='0' class="tabl" >
<tr align='center' height="22" >
<td width="97" height="34" align="center" bgcolor="#EAEEB3" >文章ID</td>
<td width="38" align="center" bgcolor="#EAEEB3">选择</td>
<td width="740" align='center' bgcolor="#EAEEB3">文章标题</td>
<td width="107" align='center' bgcolor="#EAEEB3">置顶排序</td>
<td width="116" align="center" bgcolor="#EAEEB3">所有操作</td>
</tr>
<form action='select_line.php' method='POST' enctype="multipart/form-data" name='myform'>
<input name="dopost" id="dopost" type="hidden" >
{dede:datalist}
<tr align='center' height="22" >
<td height="31" align="center" bgcolor="#FFFFE8" >
<input name="id[]" type="hidden" value="{dede:field.id/}">
{dede:field.id/}</td>
<td align="center" bgcolor="#FFFFE8"><input name="delid[]" type="checkbox" value="{dede:field.id/}" class="np" /></td><style>
tab1 .hover{
background:#ffffff;
}
</style>以上是部分代码,$(".tab1 td").hover(
function () {
// alert($(this).val());
$(this).addClass("hover");
},
function () {
$(this).removeClass("hover");
}
); 我这么写,不行
<tr align='center' height="22" >
<td width="97" height="34" align="center" bgcolor="#EAEEB3" >文章ID</td>
<td width="38" align="center" bgcolor="#EAEEB3">选择</td>
<td width="740" align='center' bgcolor="#EAEEB3">文章标题</td>
<td width="107" align='center' bgcolor="#EAEEB3">置顶排序</td>
<td width="116" align="center" bgcolor="#EAEEB3">所有操作</td>
</tr>
<form action='select_line.php' method='POST' enctype="multipart/form-data" name='myform'>
<input name="dopost" id="dopost" type="hidden" >
{dede:datalist}
<tr align='center' height="22" >
<td height="31" align="center" bgcolor="#FFFFE8" >
<input name="id[]" type="hidden" value="{dede:field.id/}">
{dede:field.id/}</td>
<td align="center" bgcolor="#FFFFE8"><input name="delid[]" type="checkbox" value="{dede:field.id/}" class="np" /></td><style>
tab1 .hover{
background:#ffffff;
}
</style>以上是部分代码,$(".tab1 td").hover(
function () {
// alert($(this).val());
$(this).addClass("hover");
},
function () {
$(this).removeClass("hover");
}
); 我这么写,不行
tab1 .hover{
background:#ffffff;
}
</style>
你这里都写错了啊,.tab1吧
1、
class="tabl" 定义的时候写的是 tabl 调用的时候 tab1 最后一个不是字母吧2、
<style>
.hover{ /*定义类的时候不需要加tab1*/
background:#ffffff;
}
</style>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
<style>
.hover{
background:#ffffff;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function(){
$(".tab1 td").hover(
function () {
// alert($(this).val());
$(this).addClass("hover");
},
function () {
$(this).removeClass("hover");
}
);
});
</script>
</head><body>
<table width="1098" height="87" border='0' cellpadding='0' cellspacing='0' class="tab1" >
<tr align='center' height="22" >
<td width="97" height="34" align="center" bgcolor="#EAEEB3" >文章ID</td>
<td width="38" align="center" bgcolor="#EAEEB3">选择</td>
<td width="740" align='center' bgcolor="#EAEEB3">文章标题</td>
<td width="107" align='center' bgcolor="#EAEEB3">置顶排序</td>
<td width="116" align="center" bgcolor="#EAEEB3">所有操作</td>
</tr>
<tr align='center' height="22" >
<td height="31" align="center" bgcolor="#FFFFE8" >
<input name="id[]" type="hidden" value="{dede:field.id/}">
{dede:field.id/}</td>
<td align="center" colspan="4" bgcolor="#FFFFE8"><input name="delid[]" type="checkbox" value="{dede:field.id/}" class="np" /></td>
</tr>
</table>
</body></html>
<tr align='center'>
<td width="97" height="34" align="center" bgcolor="#EAEEB3" >文章ID</td>
<td width="38" align="center" bgcolor="#EAEEB3">选择</td>
<td width="740" align='center' bgcolor="#EAEEB3">文章标题</td>
<td width="107" align='center' bgcolor="#EAEEB3">置顶排序</td>
<td width="116" align="center" bgcolor="#EAEEB3">所有操作</td>
</tr>
</table>
<style>
.tabl .hover{
background-color: #fff
}
</style>
<script language="javascript">
$(document).ready(function(){
$(".tabl tr td").hover(
function () {
$(this).addClass("hover");
},
function () {
$(this).removeClass("hover");
}
);
})
</script>
否则就逐个TD修改背景色