关于用SCRIPT函数实现折叠区域的问题
我用的是.net开发平台,后台代码用的是c#。
我用SCRIPT语言在html页面写了一个函数:
<SCRIPT language="javascript">
function show(tabid,imgid){
if(tabid.style.display!='none')
{
imgid.src='../Common/images/arrow_show.gif';
tabid.style.display='none';
}
else
{
imgid.src='../Common/images/arrow_hide.gif';
tabid.style.display='block';
}
}
</SCRIPT>
在某处调用这个函数,<td align="right" width="11%"><IMG id="ImageButton11" onclick="javascript:show(table_index,ImageButton11)" src="../Common/images/arrow_hide.gif"
height="21"></td>,可以实现折叠功能。
而在另一个地方调用该函数,却报网页有错误,写发都是一样的,为什么会出现这个问题,请高手指点,程序如下:<td align="right" width="11%"><IMG id="ImageButton10" onclick="javascript:show(table_line,ImageButton10)" src="../Common/images/arrow_show.gif"
height="21"></td>
我个人总结的是,只有当该区域默认展开时,才有效;默认为收缩时,报错。是否我的函数写的不对,'none'和'block'分别表示什么意思?