欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery代碼實(shí)現(xiàn)表格中點(diǎn)擊相應(yīng)行變色功能

 更新時(shí)間:2016年05月09日 14:02:03   作者:張楊  
對(duì)于一個(gè)表格,為了更好的用戶體驗(yàn)度,需要把選中的表格項(xiàng)添加高亮,下面小編給大家介紹使用jquery實(shí)現(xiàn)表格中點(diǎn)擊相應(yīng)行變色功能的實(shí)例代碼,需要的朋友參考下

對(duì)于一個(gè)表格,為了使我們選中的項(xiàng)更容易區(qū)分,需要為選中項(xiàng)添加高亮,同時(shí)也需要,將其他項(xiàng)的高亮形式去除。類似于:


<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.3.2.min.js"></script>
<script>
$(function () {
$('tbody>tr').click(function () {
$(this).addClass('selected') //為選中項(xiàng)添加高亮
.siblings().removeClass('selected')//去除其他項(xiàng)的高亮形式
.end();
});
}); 
</script>
</head>
<body>
<table>
<thead>
<tr><th>姓名</th><th>性別</th><th>暫住地</th></tr>
</thead>
<tbody>
<tr><td>張三</td><td>男</td><td>浙江寧波</td></tr>
<tr><td>張三</td><td>男</td><td>浙江寧波</td></tr>
<tr><td>張三</td><td>男</td><td>浙江寧波</td></tr>
<tr><td>張三</td><td>男</td><td>浙江寧波</td></tr>
<tr><td>張三</td><td>男</td><td>浙江寧波</td></tr>
</tbody>
</table>
</body>
</html> 

以上內(nèi)容是小編給大家介紹的jQuery代碼實(shí)現(xiàn)表格中點(diǎn)擊相應(yīng)行變色功能的全部?jī)?nèi)容,希望對(duì)大家有所幫助!

相關(guān)文章

最新評(píng)論