用js控制表格的隐藏与显示

-----------------------------------------------------------
<script>
function show()
{
if (t2.style.display=="none")
{
t2.style.display=""
//t3.style.display="none"
}
else
{
t2.style.display="none"
//t3.style.display=""
}

}
</script>
<table name="t1" border="2">
<tr>
<td>
<form name="form1">
<input type="radio" οnclick="show()">显示/影藏
</form>
</td>
</tr>
</table>
<table id="t2" border="2" style="display:none">
<tr>
<td>t2</td>
</tr>
</table>
<table id="t3" border="2">
<tr>
<td>t3</td>
</tr>
</table>
<table id="t4" border="2">
<tr>
<td>t4</td>
</tr>
</table>
----------------------------------------------------------------------
<table name="t1" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name="form1" method="post" action="">
<input type="checkbox" name="radiobutton" value="radiobutton" οnclick="t2.style.display=checked?'':'none'" checked>
显示/隐藏
</form>
</td>
</tr>
</table>
<table id="t2" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;2</td>
</tr>
</table>
<table name="t3" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;3</td>
</tr>
</table>
<table name="t4" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;4</td>
</tr>
</table>
-----------------------------------------------------------------------
<table name="t1" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name="form1" method="post" action="">
<input type="checkbox" name="radiobutton" value="radiobutton" οnclick="t2.style.display=checked?'':'none';t3.style.display=checked?'none':''">
显示/隐藏
</form>
</td>
</tr>
</table>
<table id="t2" width="100%" border="0" cellspacing="0" cellpadding="0" style="display:none">
<tr>
<td>&nbsp;2</td>
</tr>
</table>
<table id="t3" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;3</td>
</tr>
</table>
<table name="t4" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;4</td>
</tr>
</table>
---------------------------------------------------------------------------
<table id="sbr">
<tr>
<td>sdaf</td>
</tr>
<table>
<input name=button1 type=button value="按" οnclick=show()>
<script language=javascript>
function show()
{
var obj=document.getElementById("sbr")
obj.style.display=(obj.style.display=="")?"none":""
}
</script>
----------------------------------------------------------------------
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值