javascript显示隐藏表格的行
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function Button2_onclick() {//显示和隐藏表格的行;
if (tr1.style.display == "") {
tr1.style.display = "none";
} else {
tr1.style.display = "";
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input type=button value='显示' onclick='javascript:Button2_onclick()'>
<table border=1>
<tr><td>sdfsdf</td></tr>
<tr id=tr1 style='display:none'><td>sdfsd</td></tr>
</table>
</form>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function Button2_onclick() {//显示和隐藏表格的行;
if (tr1.style.display == "") {
tr1.style.display = "none";
} else {
tr1.style.display = "";
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input type=button value='显示' onclick='javascript:Button2_onclick()'>
<table border=1>
<tr><td>sdfsdf</td></tr>
<tr id=tr1 style='display:none'><td>sdfsd</td></tr>
</table>
</form>
</body>
</html>