jQuery如何选择表格中的一行?
一个公告栏的表格,有新公告用户没有点击“查看”时,整行是粗体显示的,点击“查看”后,会弹层显示公告内容,弹层我用的是fancybox插件,该插件的onComplete属性我回调了一个函数,来removeClass,让表格的该行文字不再用粗体显示,但始终无法实现,应该是没有选择到点击链接所在的行,请假下该如何选择。
代码如下:
代码如下:
<!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=gb2312">
<title>系统公告</title>
<link href="css/now.css" type="text/css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="css/jquery.fancybox-1.3.4.css" media="screen">
<style type="text/css">
.trTitle {
font-size:15px;
font-weight:bold;
}
.popupStyle {
width: 600px;
height: 300px;
padding:6px;
overflow: auto;
text-indent: 33px;
line-height: 25px;
}
</style>
<script type="text/javascript" src="js/jquery.1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-1.3.4.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("a#popupID").fancybox({
'titleShow':false,
'transitionIn':'none',
'transitionOut':'none',
'padding':0,
'overlayOpacity':0.6,
'onComplete':function() {
$(this).parent("TD").prevAll("TR")[0].removeClass("trTitle");
}
});
});
</script>
</head>
<body>
<TABLE cellpadding="0" cellspacing="1" width="68%" border="0">
<TR class="tr_title">
<TD width="33">状态</TD>
<TD width="66">类型</TD>
<TD width="150">发布时间</TD>
<TD>内容</TD>
</TR>
<TR>
<TD></TD>
<TD>系统公告</TD>
<TD>2016-03-01 15:47</TD>
<TD align="left">系统更新公告(20160301) <a id='popupID' href='#popup29'>[查看]</a>
<div style='display:none;'><div id='popup29' class='popupStyle'>系统更新公告(20160301)</div></div></TD>
</TR>
<TR class="trTitle">
<TD>新</TD>
<TD>系统公告</TD>
<TD>2015-03-19 23:33</TD>
<TD align="left">系统更新公告(20150320) <a id='popupID' href='#popup16'>[查看]</a>
<div style='display:none;'><div id='popup16' class='popupStyle'>系统更新公告(20150320)</div></div></TD>
</TR>
<TR class="trTitle">
<TD>新</TD>
<TD>系统公告</TD>
<TD>2014-09-15 22:37</TD>
<TD align="left">系统更新公告(20140916) <a id='popupID' href='#popup4'>[查看]</a>
<div style='display:none;'><div id='popup4' class='popupStyle'>系统更新公告(20140916)</div></div></TD>
</TR>
<TR>
<TD></TD>
<TD>系统公告</TD>
<TD>2014-08-15 15:18</TD>
<TD align="left">系统更新公告(20140818) <a id='popupID' href='#popup1'>[查看]</a>
<div style='display:none;'><div id='popup1' class='popupStyle'>系统更新公告(20140818)</div></div></TD>
</TR>
</TABLE>
</body>
</html>
...全文


