다음 코드는 작동하지 않지만이를 수정하는 방법은 무엇입니까? 고마워!한 행만 HTML 테이블 행을 강조 표시하는 방법을 강조 표시 할 수 있습니까?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="003.css" type="text/css" rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("tr").removeClass();
$("tr:gt(0)").click(function(){$(this).css("color","red")});
});
</script>
</head>
<style type="text/css">
.highlight td {background: red;}
</style>
</head>
<body>
<table>
<tr>
<td>NAME</td>
<td>AGE</td>
</tr>
<tr>
<td>John Smith</td>
<td>44</td>
</tr>
<tr>
<td>Mary Green</td>
<td>66</td>
</tr>
<tr>
<td>Bob Black</td>
<td>22</td>
</tr>
</table>
</body>
</html>
로
을 변경하려고? – balexandre
먼저 코드가 무엇을하고 있습니까? 두 번째로 당신은 붉은 색을 설정하고있는 것처럼 보입니까? 수업을 강조하도록 설정하면 안됩니까? 그렇지 않으면 빨간색으로 설정되고 결코 지워지지 않습니다. –
여러 행을 클릭하면 마지막 행을 클릭하는 것이 아니라 여러 행이 강조 표시되는 문제가 있습니까? –