js 展开收起效果

时间:2021-03-07 19:34:08


                                             js 展开收起效果



实现展开收起

<script type="text/javascript">
function showOrHide(){
var obj_div = document.getElementById("tableList");
obj_div.style.display = (obj_div.style.display=='none')?'block':'none';
}
</script>



<table width="96%">
<td align="center" class="fontClass">xxxxxx</td>
<td align="center" class="fontClass">xxxxxx</td>
xxxxxx
</table>

<div style="margin-top: 10px;margin-bottom: 10px;">
<a href="javascript:showOrHide()" style="font-size: 15px;">展开/收起</a>
</div>
<table width="96%" border="1" id="tableList">
<tr style="background-color: silver;">
<td width="20%" class="fontClass">资源项名:</td>
<td width="10%" class="fontClass">数据类型:</td>
<td width="10%" class="fontClass">备注</td>
<td width="10%" class="fontClass">共享属性</td>
<td width="15%" class="fontClass">不予共享理由</td>
<td width="10%" class="fontClass">公开属性</td>
<td width="15%" class="fontClass">不予公开理由</td>
</tr>
<tr class="bg_white">
<td align="center" class="fontClass">组织机构代码</td>
<td align="center" class="fontClass">字符</td>
<td align="center" class="fontClass"></td>
<td align="center" class="fontClass">普通共享</td>
<td align="center" class="fontClass"></td>
<td align="center" class="fontClass">公开</td>
<td align="center" class="fontClass"></td>
</tr>
<table>