<html>
<head>
<style>
.t{background:red;}
.yes{background:yellow;}
.ed{background:black;}
</style>
<script src="js/jquery-1.3.1.js"></script>
<script>
<!-- now i feel javascript is very at will and invisible -->
$(function(){
$("tbody>tr:odd").addClass("t");
$("tbody>tr:even").addClass("yes");
$("tr:contains('熊海洋')").addClass("ed");
});
</script>
<!--<script>
$(function () {
$('tbody>tr').click(function () {
if (!$(this).hasClass("ed")) {
alert("hello");
$(this).addClass("ed").find(":radio").attr("checked", true);
}
else {
$(this).removeClass("ed").find(":radio").attr("checked", false);
}
});
})
</script>-->
<script>
$(function (){$('tbody>tr').click(function(){
if($(this).hasClass("ed")){
alert("have no class.");
}else{
$(this).addClass('ed').siblings().removeClass('ed').end().find(':radio').attr('checked',true);
}
})})
</script>
</head>
<body>
<table>
<thead>
<tr><th></th><th>姓名</th><th>性别</th><th>暂住地</th></tr>
</thead>
<tbody>
<tr><td><input type="radio" name="radiobutton" value="radiobutton"></td><td>杨阿明</td><td>男</td><td>新乡</td></tr>
<tr><td><input type="radio" name="radiobutton" value="radiobutton"></td> <td>王亚楠</td><td>男</td><td>卫辉</td></tr>
<tr><td><input type="radio" name="radiobutton" value="radiobutton"></td><td>蒋远强</td><td>女</td><td>福罗里达</td></tr>
<tr style="color:red;"><td><input type="radio" name="radiobutton" value="radiobutton"></td><td>熊海洋</td><td>女</td><td>加利福尼亚</td></tr>
</tbody>
</table>
</body>
</html>