다음과 같이 양식을 작성했으며 행 색상을 교대로 변경하려고합니다. 머리에 jquery 스크립트를 추가했지만 작동하지 않습니다. 나는 틀린 것을 모른다. 제발 누군가가 이것을 해결하십시오.대체 표 행 색상 변경
미리 감사드립니다.
home.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=utf-8" />
<link rel="stylesheet" href="jquery.dataTables.css" type="text/css" />
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#example').dataTable();
});
</script>
<script type="text/javascript">
$(function(){
$("table.dataTable tbody tr :even").addClass("d0");
$("table.dataTable tbody tr :odd").addClass("d1");
});
</script>
</head>
<body>
<table id="example" class="row-border" cellspacing="0" width="100%">
<thead>
<tr>
<th>Client</th>
<th>Financial Year</th>
<th>Short Description</th>
<th>Full Description</th>
<th>File Upload</th>
<th>Assign TO</th>
<th>Action</th>
</tr>
</thead>
<tbody>
**<tr class="d0">**
<td>C1</td>
<td>2014-15</td>
<td>Hi</td>
<td>Hello</td>
<td>Information.pdf</td>
<td>P232</td>
<td>Edit</td>
</tr>
**<tr class="d1">**
<td>C2</td>
<td>2015-16</td>
<td>Hi</td>
<td>Hello</td>
<td>Tech.xls</td>
<td>P17</td>
<td>Edit</td>
</tr>
</tbody>
</table>
</body>
</html>
있는 style.css
table.dataTable tbody tr {
background-color: #FFC;
}
사용 의사 선택기 홀수 내가 그것을 가지고도 –