打印隐藏
用于打印隐藏
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>3-8</title>
<!-- 引入jQuery -->
<script src="../../scripts/jquery-1.3.1.js" type="text/javascript"></script>
<script type="text/javascript">
//获取下在P标签的title的值
$(function(){
//第一个button, 用于 设置<p>元素的属性'title'
$("#btn").click(function(){
if(this.checked==true){
$("td.eq(3)").each(function(){
// alert(this.childNodes.item(0).nodeValue);
if(this.childNodes.item(0).nodeValue=="aa"){
this.parentNode.style.display="none";
}
})
}else{
$("tr > td").each(function(){
// alert(this.childNodes.item(0).nodeValue);
if(this.childNodes.item(0).nodeValue=="aa"){
this.parentNode.style.display="";
}
})
}
});
});
</script>
</head>
<body>
隐藏<input type="checkbox" id="btn" ><br>
<input type="button" id="btn1" value="隐藏 ">
<table>
<tr>
<td>1</td>
<td>asdfasdf</td>
<td>sdafdas</td>
<td>aa</td>
</tr>
<tr>
<td>2</td>
<td>sdfa</td>
<td>sfa</td>
<td>aa</td>
</tr>
<tr>
<td>3</td>
<td>sdfdas</td>
<td>sdfasd</td>
<td>aa</td>
</tr>
<tr>
<td>4</td>
<td>aa</td>
<td>dsfas</td>
<td>fas</td>
</tr>
</table>
</body>
</html>