<HTML>
<HEAD>
<META http-equiv='Content-Type' content='text/html; charset=gb2312'>
<TITLE> simple IE only</TITLE>
</HEAD>
<BODY >
<script language="javascript">
function disp_something(str,dd)
{
objs=document.getElementById(dd);
obj=document.getElementById(str);
if(obj)
{
if(obj.style.display=="")
{
obj.style.display="none";
objs.src="../images/left.gif";
}
else if(obj.style.display=="none")
{
obj.style.display="";
objs.src="../images/down11.gif";
}
}
}
</script>
<tr height="25">
<td bgcolor="#F0F0F0" align=left width="75%" colspan="3">
<a href="#" onclick="disp_something('TT142-64','T142-64')"> <!--点击后不能隐藏-->
<img src="../images/down11.gif" border="0" name='T142-64' align="absmiddle"> </a> <b>
546666666666666666666666方祝元 </b>
</td>
<td bgcolor="#F0F0F0" align=Left nowrap colspan="2"> <b> 报销总金额:¥800.00 </b> </td>
</tr><div id='TT142-64' style="display:none;"> <!--不能隐藏-->
<tr>
<td height="20px" align="Left" colspan="3">
<a href="#" onclick="disp_something('TT2007-12-13-64-142','T2007-12-13-64-142')">
<img src="../images/down11.gif" border="0" name='T2007-12-13-64-142' align="absmiddle"> </a> <b> 2007-12-13 </b>
</td>
<td align="left" nowrap> <b> 报销金额:¥800.00 </b> </td>
<td height="20px" align="center">
</td>
</tr>
</div> </BODY>
</HTML>
我这可以
table里的tr,加div后就破坏了table的结构可以直接给tr加个id,直接操纵tr的隐藏
<tr id='TT142-64'>
<td height="20px" align="Left" colspan="3">
<a href="#" onclick="disp_something('TT2007-12-13-64-142','T2007-12-13-64-142')">
<img src="../images/down11.gif" border="0" name='T2007-12-13-64-142' align="absmiddle"> </a> <b> 2007-12-13 </b>
</td>
<td align="left" nowrap> <b> 报销金额:¥800.00 </b> </td>
<td height="20px" align="center">
</td>
</tr>
<tr id='TT142-64'>
<td height="20px" align="Left" colspan="3">
<a href="#" onclick="disp_something('TT2007-12-13-64-142','T2007-12-13-64-142')">
<img src="../images/down11.gif" border="0" name='T2007-12-13-64-142' align="absmiddle"> </a> <b> 2007-12-13 </b>
</td>
<td align="left" nowrap> <b> 报销金额:¥800.00 </b> </td>
<td height="20px" align="center">
</td>
</tr>to mingxuan3000 如果有两行记录怎么处理???
alert(document.getElementsByName("name").length)
alert(document.getElementsByName("name")[0].value)
alert(document.getElementsByName("name")[1].value)
...
http://yafei.iteye.com/blog/743860